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 fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x), end(x)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pii;
const ll inf = 1e18;
const int i_inf = 1e9;
const ll mod = 1e9+7;
const int mxn = 2e6+5;
const ll A = 911382323;
const ll B = 972663749;
mt19937 _rand(time(NULL));
clock_t z;
int n;
string s;
void solve(){
cin >> n;
cin >> s;
if(n%2 == 0){
cout<<"NOT POSSIBLE"<<endl;
return;
}
int len = n/2;
string ans = "";
fr(i, 0, n){
string s1 = "";
string s2 = "";
fr(j, 0, n){
if(i == j) continue;
if((int)s1.size() < len) s1 += s[j];
else s2 += s[j];
}
if(s1 == s2){
if(ans != "" && ans != s1){
cout<<"NOT UNIQUE"<<endl;
return;
}
ans = s1;
}
}
if(ans == ""){
cout<<"NOT POSSIBLE"<<endl;
return;
}
cout<<ans<<endl;
}
int main(){
//freopen("untitled.in", "r", stdin);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |