Submission #1200562

#TimeUsernameProblemLanguageResultExecution timeMemory
1200562amanthabandThree Friends (BOI14_friends)C++20
35 / 100
1093 ms7304 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    string u;
    cin >> n >> u;

    set<string> ans;

    for (int i = 0; i < n; i++) {
        string t = u.substr(0, i) + u.substr(i + 1);
        if (t.size() % 2 != 0) continue;
        int m = t.size() / 2;
        string a = t.substr(0, m);
        string b = t.substr(m);
        if (a == b) ans.insert(a);
    }

    if (ans.size() == 0) cout << "NOT POSSIBLE\n";
    else if (ans.size() > 1) cout << "NOT UNIQUE\n";
    else cout << *ans.begin() << '\n';

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...