# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
944684 | tamir1 | Three Friends (BOI14_friends) | C++17 | 1049 ms | 7204 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>
#define ll long long
using namespace std;
ll n,i,j,cnt,ans;
string t,u,s;
bool check(string s){
ll n=s.size(),i;
for(i=0;i<n/2;i++){
if(s[i]!=s[i+n/2]) return 0;
}
return 1;
}
int main(){
cin >> n >> u;
if(n%2==0){
cout << "NOT POSSIBLE";
return 0;
}
for(i=0;i<n;i++){
t.clear();
for(j=0;j<n;j++){
if(j==i) continue;
t=t+u[j];
}
if(check(t)){
ans=i;
if(s!=t) cnt++;
s=t;
}
}
if(cnt==0) cout << "NOT POSSIBLE";
else if(cnt>1) cout << "NOT UNIQUE";
else{
for(i=0;i<s.size()/2;i++) cout << s[i];
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |