Submission #398771

#TimeUsernameProblemLanguageResultExecution timeMemory
398771YaserFaisalThree Friends (BOI14_friends)C++14
0 / 100
1088 ms6728 KiB
#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 ; int counter = 0 ; string ans ; for ( int i = 0 ; i < n+1 ; i++ ) { string g = s ; g.erase(g.begin()+i) ; int x = n/2 ; string a = g.substr(0,x) ; string b = g.substr(x,ceil(double(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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...