Submission #713937

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