Submission #413834

#TimeUsernameProblemLanguageResultExecution timeMemory
413834BlagojceThree Friends (BOI14_friends)C++11
35 / 100
1086 ms6472 KiB
#include <bits/stdc++.h> #define fr(i, n, m) for(int i = (n); i < (m); i ++) #define pb push_back #define st first #define nd second #define pq priority_queue #define all(x) begin(x), end(x) using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll,ll> pii; const ll inf = 1e18; const int i_inf = 1e9; const ll mod = 1e9+7; const int mxn = 2e6+5; const ll A = 911382323; const ll B = 972663749; mt19937 _rand(time(NULL)); clock_t z; int n; string s; void solve(){ cin >> n; cin >> s; if(n%2 == 0){ cout<<"NOT POSSIBLE"<<endl; return; } int len = n/2; string ans = ""; fr(i, 0, n){ string s1 = ""; string s2 = ""; fr(j, 0, n){ if(i == j) continue; if((int)s1.size() < len) s1 += s[j]; else s2 += s[j]; } if(s1 == s2){ if(ans != "" && ans != s1){ cout<<"NOT UNIQUE"<<endl; return; } ans = s1; } } if(ans == ""){ cout<<"NOT POSSIBLE"<<endl; return; } cout<<ans<<endl; } int main(){ //freopen("untitled.in", "r", stdin); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...