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;
//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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |