제출 #1332065

#제출 시각아이디문제언어결과실행 시간메모리
1332065kawhiet세 명의 친구들 (BOI14_friends)C++20
0 / 100
1096 ms6296 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    string u;
    cin >> n >> u;
    // if (n % 2 == 0) {
    //     cout << "NOT POSSIBLE\n";
    //     return 0;
    // }
    string s;
    for (int i = 0; i < n; i++) {
        string a, b;
        for (int j = 0; j < n; j++) {
            if (i == j) continue;
            if (a.size() < n / 2) {
                a += u[j];
            } else {
                b += u[j];
            }
        }
        if (a == b) {
            if (!s.empty()) {
                cout << "NOT UNIQUE\n";
                return 0;
            }
            s = a;
        }
    }
    if (s.empty()) {
        cout << "NOT POSSIBLE\n";
    } else {
        cout << s << '\n';
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...