Submission #135964

#TimeUsernameProblemLanguageResultExecution timeMemory
135964ZexThree Friends (BOI14_friends)C++11
35 / 100
1053 ms9164 KiB
#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++){ if( i && s[i] == s[i-1] ) continue; 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...