This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |