Submission #657098

#TimeUsernameProblemLanguageResultExecution timeMemory
657098JuanThree Friends (BOI14_friends)C++17
0 / 100
4 ms468 KiB
#include<bits/stdc++.h> using namespace std; const int maxn = 2e3 + 5; char v[maxn]; int main(){ int n; cin >> n; for(int i = 1; i <= n; i++) cin >> v[i]; int okcnt = 0; string ans = ""; for(int i = 1; i <= n; i++){ bool ok = true; for(int j = 1; j <= n/2+(i<=n/2); j++){ if(j==i) continue; if(v[j]!=v[j+(n/2)+(i<=j+n/2)-(i<j)]) {ok = false; break;} } if(ok){ for(int j = 1; j <= n/2+(i<=n/2); j++){ if(j==i) continue; ans+=v[j]; } if(okcnt) {cout << "NOT UNIQUE\n"; return 0;} okcnt++; } } if(okcnt==0) cout << "NOT POSSIBLE\n"; else cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...