Submission #105589

#TimeUsernameProblemLanguageResultExecution timeMemory
105589thiago4532Three Friends (BOI14_friends)C++17
0 / 100
1058 ms8448 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string str; cin >> str; string resp; int ct=0; for(int i=0;i<n;i++){ string x; for(int j=0;j<n;j++) if(j != i) x += str[j]; int k = x.size()/2; int p1=0, p2=k; bool consegue = true; while(p1 < k){ if(x[p1] != x[p2]){ consegue = false; break; } p1++, p2++; } if(consegue){ ct++; for(int j=0;j<k;j++) resp += x[j]; } if(ct > 1){ cout << "NOT UNIQUE\n"; return 0; } } cout << (ct ? resp : "NOT POSSIBLE") << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...