제출 #503299

#제출 시각아이디문제언어결과실행 시간메모리
503299MurotY세 명의 친구들 (BOI14_friends)C++14
35 / 100
1099 ms6340 KiB
#include <bits/stdc++.h> #define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ff first #define ll long long #define ss second using namespace std; const int N=5*1e5+1; ll t[N], x[N], y[N], v[N]; ll dar(ll a, ll b){ ll res=1; for (int i=1;i<=b;i++) res*=a; return res; } int main() { int n, ans=0; cin >> n; string s, ans1; cin >> s; if (n % 2 == 0){ cout << "NOT POSSIBLE"; return 0; } for (int i=0;i<n;i++){ string s1=s, s2=s; s1.erase(i, 1); s2.erase(i, 1); s1.erase(n/2, n); s2.erase(0, n/2); if (s1 == s2 and ans1 != "" and ans1 != s1){ cout << "NOT UNIQUE"; return 0; } if (s1 == s2){ ans++; ans1=s1; } } if (ans == 0) cout << "NOT POSSIBLE"; else cout << ans1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...