Submission #503288

#TimeUsernameProblemLanguageResultExecution timeMemory
503288MurotYThree Friends (BOI14_friends)C++14
0 / 100
1063 ms7116 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){ ans++; ans1=s1; } } string s1=s, s2=s; s1.erase(0, n/2); s2.erase(n/2, n); if (s1 == s2){ cout << s1; return 0; } if (ans == 0 || n < 3) cout << "NOT POSSIBLE"; else if (ans > 1) cout << "NOT UNIQUE"; else cout << ans1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...