Submission #398737

#TimeUsernameProblemLanguageResultExecution timeMemory
398737faresbasbsThree Friends (BOI14_friends)C++14
0 / 100
1094 ms6348 KiB
#include <bits/stdc++.h> using namespace std; string s; int n; int main(){ cin >> n >> s; if(n%2 == 0){ cout << "NOT POSSIBLE" << endl; return 0; } vector<string> ans; for(int i = 0 ; i < n ; i += 1){ string s1="",s2=""; int pos = 0 , cnt = 0; while(cnt < n/2){ if(pos == i){ pos += 1; continue; } s1 += s[pos]; pos += 1 , cnt += 1; } while(pos < n){ if(pos == i){ pos += 1; continue; } s2 += s[pos]; pos += 1 , cnt += 1; } if(s1 == s2){ ans.push_back(s1); } } if(ans.size() == 0){ cout << "NOT POSSIBLE" << endl; }else if(ans.size() == 1){ cout << ans[0] << endl; }else{ cout << "NOT UNIQUE" << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...