제출 #987191

#제출 시각아이디문제언어결과실행 시간메모리
987191Aiperiii세 명의 친구들 (BOI14_friends)C++14
35 / 100
1004 ms6360 KiB
#include <bits/stdc++.h> #define int long long #define ff first #define ss second #define pb push_back #define all(x) x.begin(),x.end() using namespace std; signed main(){ ios_base::sync_with_stdio(); cin.tie(0);cout.tie(0); int n; string s; cin>>n>>s; if(n%2==0){ cout<<"NOT POSSIBLE\n"; return 0; } set <string> st; for(int i=0;i<n;i++){ string x=s; string y=""; x.erase(i,1); bool ok=1; for(int j=0;j<n/2;j++){ if(x[j]!=x[n/2+j]){ ok=0;break; } y+=x[j]; } if(ok)st.insert(y); } if(!st.size())cout<<"NOT POSSIBLE\n"; else if(st.size()==1)cout<<*st.begin()<<"\n"; else cout<<"NOT UNIQUE\n"; } /* 4 3 -2 3 5 8 2 -4 7 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...