제출 #930677

#제출 시각아이디문제언어결과실행 시간메모리
930677MinhAnhnd세 명의 친구들 (BOI14_friends)C++14
0 / 100
92 ms33984 KiB
#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; #define ll __int128 #define maxn 300001 #define INF 1000000001 #define pa pair<ll,ll> #define vi(t) vector<t> //long long T[1000002]; long SS[2000002]; long Left[2000002]; long Right[2000002]; int main(){ long N; cin>>N; for(long i = 1;i<=N;i++){ char temp; cin>>temp; SS[i] = (long)temp; } if (N%2==0) { cout<<"NOT POSSIBLE"; return 0; } long j = N/2 + 1; long used = 0; for (long i = 1;i<=N/2;i++){ Left[i] = SS[i]; while(SS[i]!=SS[j]){ j++; used++; if (used==2){ Left[0] = 1; break; } } if (used==2){ Left[0] = 1; break; } j++; } cout<<used; j = 1; used = 0; for (long i = 1;i<=N/2;i++){ Right[i] = SS[i+N/2+1]; while(SS[i+N/2+1]!=SS[j]){ j++; used++; if (used==2){ Right[0] = 2; break; } } if (used==2){ Right[0] = 2; break; } j++; } if (Right[0]==2 && Left[0]==1){ cout<<"NOT POSSIBLE"; return 0 ; } if (Right[0]==2){ for (long i = 1;i<=N/2;i++) cout<<(char)Left[i]; return 0; } if (Left[0]==1){ for (long i = 1;i<=N/2;i++) cout<<(char)Right[i]; return 0; } for (long i = 1;i<=N/2;i++) if (Left[i]!=Right[i]){ cout<<"NOT UNIQUE"; return 0; } for (long i = 1;i<=N/2;i++) cout<<(char)Right[i]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...