제출 #713937

#제출 시각아이디문제언어결과실행 시간메모리
713937Stickfish세 명의 친구들 (BOI14_friends)C++17
35 / 100
1066 ms6468 KiB
#include <iostream> #include <string> #include <vector> using namespace std; signed main() { int n; cin >> n; string s; cin >> s; if (n % 2 == 0) { cout << "NOT POSSIBLE\n"; return 0; } int m = n / 2; string ans = "NOT POSSIBLE"; for (int i = 0; i < n; ++i) { string t = s; t.erase(t.begin() + i); if (t.substr(0, m) == t.substr(m, m)) { if (ans == "NOT POSSIBLE" || ans == t.substr(0, m)) { ans = t.substr(0, m); } else { cout << "NOT UNIQUE\n"; return 0; } } } cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...