# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1111797 | ThegeekKnight16 | Three Friends (BOI14_friends) | C++17 | 1061 ms | 9660 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tam;
cin >> tam;
if (tam % 2 == 0) {cout << "NOT POSSIBLE" << '\n'; return 0;}
int N = (tam-1)/2;
string S; cin >> S;
int resp = -1;
for (int r = 0; r < tam; r++)
{
string S2 = "";
for (int i = 0; i < tam; i++) if (i != r) S2 += S[i];
bool ok = 1;
for (int i = 0; i < N; i++) if (S2[i] != S2[i+N]) {ok = 0; break;}
if (ok && resp == -1) resp = r;
else if (ok) {cout << "NOT UNIQUE" << '\n'; return 0;}
}
if (resp == -1) {cout << "NOT POSSIBLE" << '\n'; return 0;}
int cnt = 0;
for (int i = 0; cnt < N; i++) if (i != resp) {cout << S[i]; cnt++;} cout << '\n';
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |