Submission #17415

#TimeUsernameProblemLanguageResultExecution timeMemory
17415choyi0521Three Friends (BOI14_friends)C++98
0 / 100
145 ms3672 KiB
#include<iostream> using namespace std; const int MAX_N=2000001; int n; char str[MAX_N+1]; int query(int mid,int set){ int i,f1=0,f2=0; for(i=0; i<n/2; i++){ if(str[i+f1]==str[i+mid+f2]) continue; if(f1|f2) break; set?f2++:f1++; } return i==n/2; } int main(){ cin >> n >> str; int r1=query(n/2,1),r2=query(n/2+1,0); if(r1&r2) cout<<"NOT UNIQUE"; else if(r1) for(int i=0; i<n/2; i++) cout << str[i]; else if(r2) for(int i=n/2+1; i<n; i++) cout << str[i]; else cout << "NOT POSSIBLE"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...