제출 #713935

#제출 시각아이디문제언어결과실행 시간메모리
713935Stickfish세 명의 친구들 (BOI14_friends)C++17
0 / 100
1058 ms6544 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) { ans = t; } else { cout << "NOT UNIQUE\n"; return 0; } } } cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...