이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define INF INT_MAX
#define output for(int i=0;i<sizex;i++) { for(int j=0;j<sizey;j++) { cout << moveChart[i][j] << " "; }cout<<endl; }cout<<endl;
const int maxN = 2001;
int N;
string s;
bool CHECK( string S ){
    int n = S.length()/2;
    return S.substr( 0, n ) == S.substr( n, n );
}
int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> N >> s;
    if( !( N & 1 ) ){
        cout << "NOT POSSIBLE" << endl; return 0;
    }
    string res;
    int resCount = 0;
    for(int i=0;i<N;i++){
        string S = s.substr( 0, i ) + s.substr( i+1, INF );
        if( CHECK( S ) ){
            resCount++;
            res = S;
        }
        if( resCount > 1 ) break;
    }
    if( !resCount ) cout << "NOT POSSIBLE" << endl;
    else if( resCount == 1 ) cout << res.substr( 0, int(res.length())/2 ) << endl;
    else cout << "NOT UNIQUE" << endl;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |