Skip to content

Instantly share code, notes, and snippets.

@rigibun
Created June 18, 2013 17:08
Show Gist options
  • Save rigibun/5807300 to your computer and use it in GitHub Desktop.
Save rigibun/5807300 to your computer and use it in GitHub Desktop.
#include<iostream>
#include<string>
#include<vector>
using namespace std;
vector<string> arr;
bool search(string);
int main(void){
int n;
string str1, str2;
cin >> n;
cin >> str1;
arr.push_back(str1);
n--;
for(int i = 0; i < n; i++){
cin >> str2;
if(str1[str1.length() - 1] != str2[0] || search(str2)){
if(i&1) cout << "LOSE" << endl;
else cout << "WIN" << endl;
return 0;
}
arr.push_back(str2);
str1 = str2;
}
cout << "DRAW" << endl;
return 0;
}
bool search(string str){
for(int i = 0; i < arr.size(); i++){
if(arr[i] == str) return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment