# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
398844 | almothana05 | Three Friends (BOI14_friends) | C++14 | 14 ms | 5240 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<iostream>
#include<vector>
#include<string>
#include<string.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int menge , numm , nummer ,cmp1 , cmp2 , mit;
bool kann1 = 0 , kann2 = 0;
string s , s1 ,s2;
cin >> menge >> s;
if(menge % 2 == 0){
cout << "NOT POSSIBLE" << endl;
return 0;
}
mit = menge /2;
for(int i = 0 , j = mit + 1 ; i <= mit ; i++ ){
if(s[i] == s[j]){
j++;
}
if(j == menge ){
kann1 = 1;
break;
}
}
for(int i = mit , j = 0 ; i < menge ;i++){
if(s[i] == s[j]){
j++;
}
if(j == mit ){
kann2 = 1;
break;
}
}
s1 = s.substr(0 , mit);
s2 = s.substr(mit + 1 , mit);
if(kann1 == 1){
if(kann2 == 1 && s1 != s2){
cout << "NOT UNIQUE" << endl;
}
else{
cout << s2 << endl;
}
}
else if(kann2 == 1){
cout << s1 << endl;
}
else{
cout << "NOT POSSIBLE"<< endl;
}
//cout << kann1 << ' ' << nu1 << "\n" << kann2 << ' ' << nu2<<"\n";
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |