Submission #17419

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