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>
using namespace std;
int main() {
int n;
cin >> n;
if(n%2 == 0){
cout << "NOT POSSIBLE\n";
return 0;
}
string str;
cin >> str;
string resp = "NOT POSSIBLE";
for(int i=0;i<n;i++){
string x;
for(int j=0;j<n;j++)
if(j != i) x += str[j];
int k = x.size();
string a, b;
for(int j=0;j<k/2;j++)
a += x[j];
for(int j=k/2;j<k;j++)
b += x[j];
if(a == b){
if(resp != "NOT POSSIBLE" && resp != a){
cout << "NOT UNIQUE\n";
return 0;
}
resp = a;
}
}
cout << resp << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |