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 <iostream>
#include <string>
#include <vector>
using namespace std;
signed main() {
int n;
cin >> n;
string s;
cin >> s;
if (n % 2 == 0) {
cout << "NOT POSSIBLE\n";
return 0;
}
int m = n / 2;
string ans = "NOT POSSIBLE";
for (int i = 0; i < n; ++i) {
string t = s;
t.erase(t.begin() + i);
if (t.substr(0, m) == t.substr(m, m)) {
if (ans == "NOT POSSIBLE" || ans == t) {
ans = t;
} else {
cout << "NOT UNIQUE\n";
return 0;
}
}
}
cout << ans << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |