제출 #398743

#제출 시각아이디문제언어결과실행 시간메모리
398743YaserFaisal세 명의 친구들 (BOI14_friends)C++14
0 / 100
1085 ms6608 KiB
#include <bits/stdc++.h> using namespace std ; //#define int long long int MOD = 1e9+7 ; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n ; cin >> n ; string s ; cin >> s ; if ( n % 2 == 0 ) { cout << "NOT POSSIBLE\n" ; return 0 ; } int counter = 0 ; string ans ; for ( int i = 0 ; i < n ; i++ ) { string g = s ; g.erase(g.begin()+i) ; string a = g.substr(0,n/2) ; string b = g.substr(n/2,n/2) ; 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...