Submission #1263505

#TimeUsernameProblemLanguageResultExecution timeMemory
1263505bruhhhhThree Friends (BOI14_friends)C++20
0 / 100
1095 ms8204 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll n; string s; cin >> n >> s; bool check = false; string ans = ""; for (int i = 0; i < n; i++) { string x = ""; for (int j = 0; j < n; j++) { if (j != i) { x += s[j]; } } if (x.substr(0, (n - 1) / 2) == x.substr((n - 1) / 2)) { if (check) { cout << "NOT UNIQUE\n"; return 0; } check = true; ans = x.substr(0, (n - 1) / 2); } } if (check) { cout << ans << "\n"; } else { cout << "NOT POSSIBLE\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...