# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1112217 | lucascgar | Three Friends (BOI14_friends) | C++17 | 1068 ms | 6476 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;
/*
*/
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long double, long double> pdd;
const int MAXN = 2e6+11;
signed main(){
std::ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
string s;
cin >> s;
if (s.size()%2 == 0){
cout << "NOT POSSIBLE\n";
return 0;
}
vector<int> fans;
int sz = n/2;
// meio
for (int i=0;i<n;i++){
if (i>0 && s[i] == s[i-1]){
continue;
}
string a, b;
int j = 0;
while (a.size()<sz){
if (j!=i) a.push_back(s[j]);
j++;
}
while (b.size()<sz){
if (j!=i) b.push_back(s[j]);
j++;
}
if (a==b) fans.push_back(i);
}
if (fans.empty()){
cout << "NOT POSSIBLE\n";
}else if (fans.size()>1){
cout << "NOT UNIQUE\n";
// for (auto &x:fans) cerr << x << '\n';
}
else{
int x = fans.back(), q=0, j=0;
while (q<sz){
if (j!=x){
cout << s[j];
q++;
}
j++;
}
cout << '\n';
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |