This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std ;
#define int long long
int32_t main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n ; cin >> n ; n-- ;
string s ; cin >> s ;
if ( n % 2 )
{
cout << "NOT POSSIBLE\n" ;
return 0 ;
}
int counter = 0 ;
string ans ;
for ( int i = 0 ; i < n+1 ; i++ )
{
string g = s ;
g.erase(g.begin()+i) ;
string a = g.substr(0,n/2) ;
string b = g.substr(n/2,n/2) ;
cout << g << " " << a << " " << b << endl ;
if ( a == b )
{
counter++ ;
ans = a ;
}
}
if ( counter == 0 ) cout << "NOT POSSIBLE\n" ;
else if ( counter > 1 ) cout << "NOT UNIQUE\n" ;
else cout << ans << "\n" ;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |