# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
72881 | Vardanyan | Three Friends (BOI14_friends) | C++14 | 1049 ms | 32312 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.
//#pragma GCC optimize "-O3"
#include <bits/stdc++.h>
#include <ext/rope>
using namespace std;
using namespace __gnu_cxx;
int main()
{
int n;
string s;
cin>>n>>s;
rope<char> v;
int c = 0;
for(int i = 0;i<s.length();i++){
v.push_back(s[i]);
}
rope<char> ans;
for(int i = 0;i<n;i++){
char x = v[i];
v.erase(v.mutable_begin()+i);
rope<char> w = v.substr(0,n/2);
rope<char> e = v.substr(n/2,n-2);
if(w == e){
c++;
ans = w;
}
v.insert(v.mutable_begin()+i,x);
}
if(c == 0){
cout<<"NOT POSSIBLE"<<endl;
return 0;
}
if(c == 1){
for(int i = 0;i<ans.size();i++) cout<<ans[i];
cout<<endl;
return 0;
}
cout<<"NOT UNIQE"<<endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |