Submission #1094223

#TimeUsernameProblemLanguageResultExecution timeMemory
1094223SamakahhhThree Friends (BOI14_friends)C++14
0 / 100
1066 ms10404 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >>n>>s; int cnt = 0 ; string ans = "" ; for(int i=0;i<n;i++){ string s1 = "" ; for(int j=0;j<n;j++){ if(i == j) continue ; else{ s1 += s[j] ; } } int k = n - 1; if(k % 2 == 1){ continue ; } bool is = 1 ; string q = "" ; for(int i = 0 ; i < k / 2 ; i++){ if(s1[i] != s1[i + k / 2]){ is = 0 ; } q += s1[i] ; } if(is == 1){ cnt++ ; ans = q ; } } if(cnt == 0){ cout << "NOT POSSIBLE" << endl ; } else if(cnt == 1){ cout << ans << endl ; } else{ cout << "NOT UNIQUE" << endl ; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...