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;
string str;
cin >> str;
string resp;
int ct=0;
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()/2;
int p1=0, p2=k;
bool consegue = true;
while(p1 < k){
if(x[p1] != x[p2]){
consegue = false;
break;
} p1++, p2++;
}
if(consegue){
ct++;
for(int j=0;j<k;j++)
resp += x[j];
}
if(ct > 1){
cout << "NOT UNIQUE\n";
return 0;
}
}
cout << (ct ? resp : "NOT POSSIBLE") << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |