제출 #17416

#제출 시각아이디문제언어결과실행 시간메모리
17416choyi0521세 명의 친구들 (BOI14_friends)C++98
0 / 100
124 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 || 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...