제출 #398737

#제출 시각아이디문제언어결과실행 시간메모리
398737faresbasbs세 명의 친구들 (BOI14_friends)C++14
0 / 100
1094 ms6348 KiB
#include <bits/stdc++.h> using namespace std; string s; int n; int main(){ cin >> n >> s; if(n%2 == 0){ cout << "NOT POSSIBLE" << endl; return 0; } vector<string> ans; for(int i = 0 ; i < n ; i += 1){ string s1="",s2=""; int pos = 0 , cnt = 0; while(cnt < n/2){ if(pos == i){ pos += 1; continue; } s1 += s[pos]; pos += 1 , cnt += 1; } while(pos < n){ if(pos == i){ pos += 1; continue; } s2 += s[pos]; pos += 1 , cnt += 1; } if(s1 == s2){ ans.push_back(s1); } } if(ans.size() == 0){ cout << "NOT POSSIBLE" << endl; }else if(ans.size() == 1){ cout << ans[0] << endl; }else{ cout << "NOT UNIQUE" << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...