제출 #38477

#제출 시각아이디문제언어결과실행 시간메모리
38477oTTo_22세 명의 친구들 (BOI14_friends)C++14
0 / 100
500 ms11980 KiB
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
const int INF=1e9+1;
const int MAXN=1e5+1;
const int MOD=13371337;
using namespace std;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    string s;
    cin >> n >> s;

    if (n%2==0) {
        cout << "NOT POSSIBLE";
        return 0;
    }

    bool cnt=0;
    string ans;

    for (int i=0; i<n; i++) {
        string st=s;
        st.erase(i,1);
        string st1,st2;
        for (int i=0; i<(n-1)/2; i++)
            st1+=st[i];
        for (int i=(n-1)/2; i<n-1; i++)
            st2+=st[i];
        if (st1==st2) {
            if (cnt) {
                cout << "NOT UNIQUE";
                return 0;
            }
            else {
                cnt++;
                ans=st1;
            }
        }
    }

    if (cnt==0)
        cout << "NOT POSSIBLE";
    else
        cout << ans;

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