제출 #930630

#제출 시각아이디문제언어결과실행 시간메모리
930630yeehaw세 명의 친구들 (BOI14_friends)C++17
0 / 100
35 ms3388 KiB
#include <bits/stdc++.h> using namespace std; #define int long long // #pragma GCC optimize("O3,unroll-loops") // #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") int32_t main(){ ios::sync_with_stdio(0);cin.tie(0); int n;cin>>n; char a[n]; for(int i=0;i<n;i++)cin>>a[i]; if(n%2==0){ cout<<"NOT POSSIBLE"; return 0; } int in=n/2,c=0,co=2,s=1,check=0; for(int i=0;i<n/2;i++){ if(a[i]==a[i+in+c]); else{ if(i==0)check=1; i--; if(c==1){ co--; break; }c++; } } in++;c=0; for(int i=0;i<n/2;i++){ if(a[i+c]==a[i+in]); else{ i--; if(c==1){ s=0; co--; break; }c++; } } if(co==2&&check==0)cout<<"NOT UNIQUE"; else if(co==0)cout<<"NOT POSSIBLE"; else{ if(s){ c=0; for(int i=0;i<n/2;i++){ if(a[i+c]==a[i+n/2+1])cout<<a[i+c]; else {i--;c++;} } }else{ c=0; for(int i=0;i<n/2;i++){ if(a[i]==a[i+n/2+c])cout<<a[i]; else {i--;c++;} } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...