제출 #1263504

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

using ll = long long;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    string s;
    cin >> n >> s;
    bool check = false;
    string ans = "";
    if (n % 2 == 0){
        cout << "NOT POSSIBLE\n";
        return 0;
    }
    for (int i = 0; i < n; i++){
        string x = "";
        for (int j = 0; j < n; j++){
            if (j != i){
                x += s[j];
            }
        }
        if (x.substr(0, n / 2) == x.substr(n / 2)){
            if (check) {
                cout << "NOT UNIQUE\n";
                return 0;
            }
            if (!check){
                check = true;
                ans = x.substr(0, n / 2);
            }
        }
    }
    cout << (check ? ans : "NOT POSSIBLE\n");
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...