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 ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ff first
#define ll long long
#define ss second
using namespace std;
const int N=5*1e5+1;
ll t[N], x[N], y[N], v[N];
ll dar(ll a, ll b){
ll res=1;
for (int i=1;i<=b;i++) res*=a;
return res;
}
int main()
{
int n, ans=0;
cin >> n;
string s, ans1;
cin >> s;
if (n % 2 == 0){
cout << "NOT POSSIBLE";
return 0;
}
for (int i=0;i<n;i++){
string s1=s, s2=s;
s1.erase(i, 1); s2.erase(i, 1);
s1.erase(n/2, n);
s2.erase(0, n/2);
if (s1 == s2 and ans1 != "" and ans1 != s1){
cout << "NOT UNIQUE";
return 0;
}
if (s1 == s2){
ans++;
ans1=s1;
}
}
if (ans == 0) cout << "NOT POSSIBLE";
else cout << ans1;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |