Submission #1263502

#TimeUsernameProblemLanguageResultExecution timeMemory
1263502bruhhhhThree Friends (BOI14_friends)C++20
0 / 100
1093 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 / 2) == x.substr(n / 2)){ if (check) { cout << "NOT UNIQUE\n"; return 0; } if (!check){ check = true; ans = x.substr(0, n / 2); } } } cout << (check ? ans : "NOT POSSIBLE\n"); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...