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 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++;
}
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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |