Submission #398887

#TimeUsernameProblemLanguageResultExecution timeMemory
398887Abdulmohsen1284Three Friends (BOI14_friends)C++14
35 / 100
1082 ms7236 KiB
#include <bits/stdc++.h> using namespace std; //long long mo=1000000007; //long long num[100005],dis[100005],di[100005],d[100005],eis[100005],ei[100005],e[100005]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n; cin>>n; string s,an="0"; bool ans=false; cin>>s; if(s.size()%2==0) {cout<<"NOT POSSIBLE"; return 0;} for(int i=0;i<n;i++) { string c=s.substr(0,i)+s.substr(i+1,n-i); if(c.substr(0,c.size()/2)==c.substr(c.size()/2,c.size()/2)) { if(!ans) { an=c.substr(0,c.size()/2); ans=true; } else { if(an!=c.substr(0,c.size()/2)) { cout<<"NOT UNIQUE"; return 0; } } } } if(an!="0") cout<<an; else cout<<"NOT POSSIBLE"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...