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 <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
signed main(){
ios_base::sync_with_stdio();
cin.tie(0);cout.tie(0);
int n;
string s;
cin>>n>>s;
if(n%2==0){
cout<<"NOT POSSIBLE\n";
return 0;
}
set <string> st;
for(int i=0;i<n;i++){
string x=s;
string y="";
x.erase(i,1);
bool ok=1;
for(int j=0;j<n/2;j++){
if(x[j]!=x[n/2+j]){
ok=0;break;
}
y+=x[j];
}
if(ok)st.insert(y);
}
if(!st.size())cout<<"NOT POSSIBLE\n";
else if(st.size()==1)cout<<*st.begin()<<"\n";
else cout<<"NOT UNIQUE\n";
}
/*
4 3
-2 3 5 8
2
-4
7
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |