Submission #896983

#TimeUsernameProblemLanguageResultExecution timeMemory
896983NexusThree Friends (BOI14_friends)C++17
0 / 100
1036 ms13116 KiB
#include <iostream> #include <vector> #include <map> #include <set> #include <math.h> #include <string> #include <algorithm> #include <random> #include <iomanip> #include <utility> #include <cstring> //#include <bits/stdc++.h> #define ll long long #define s .size() using namespace std; const ll N=1e5+9,M=1e18+9,mod=1e9+7; //cout<<fixed<<setprecision(6)<< ll n,x,y; vector<string>v; string a,b,c,d,e,ans; bool ok(){ y=d.size()/2,e=""; for(ll i=0;i<y;++i) if(d[i]!=d[i+y])return 0; else e+=d[i]; ans=e; return 1; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n>>a; if(!(n%2))goto end; for(ll i=0;i<n;++i){ c=""; for(ll j=i+1;j<n;++j)c+=a[j]; d=b+c; if(ok())++x; if(x>1)break; b+=a[i]; } end: if(!x)cout<<"NOT POSSIBLE"; else if(x>1)cout<<"NOT UNIQUE"; else cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...