제출 #17422

#제출 시각아이디문제언어결과실행 시간메모리
17422choyi0521세 명의 친구들 (BOI14_friends)C++98
0 / 100
124 ms3676 KiB
#include<iostream> using namespace std; const int MAX_N=2000001; int n; char str[MAX_N+1]; int main(){ cin >> n >> str; int i,tmp=0; for(i=0; i<n/2 && str[i]==str[n/2+i]; i++); for(; i<n/2 && str[i]==str[n/2+1+i]; i++); if(i==n/2) tmp+=1; for(i=0; i<n/2 && str[i]==str[n/2+1+i]; i++); for(; i<n/2 && str[i+1]==str[n/2+1+i]; i++); if(i==n/2) tmp+=2; if(tmp==3 && str[0]!=str[n/2]) tmp--; if(tmp==0 || n%2==0) cout<<"NOT POSSIBLE"; else if(tmp==1) for(int i=0; i<n/2; i++) cout<<str[i]; else if(tmp==2) for(int i=n/2+1; i<n; i++) cout<<str[i]; else cout << "NOT UNIQUE"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...