Submission #713935

#TimeUsernameProblemLanguageResultExecution timeMemory
713935StickfishThree Friends (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...