Submission #1200561

#TimeUsernameProblemLanguageResultExecution timeMemory
1200561amanthabandThree Friends (BOI14_friends)C++20
Compilation error
0 ms0 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;
}
#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;
}

Compilation message (stderr)

friends.cpp:29:5: error: redefinition of 'int main()'
   29 | int main() {
      |     ^~~~
friends.cpp:4:5: note: 'int main()' previously defined here
    4 | int main() {
      |     ^~~~