Submission #1024373

#TimeUsernameProblemLanguageResultExecution timeMemory
1024373ByeWorldThree Friends (BOI14_friends)C++14
35 / 100
1090 ms6212 KiB
#include <bits/stdc++.h> #define int long long #define ll long long #define pb push_back #define fi first #define se second using namespace std; typedef pair<int,int> pii; typedef pair<int,pii> ipii; const int MAXN = 255; const int MOD = 1e9+7; const int INF = 2e18+10; int sum(int a, int b){ return (a+b)%MOD; } int mul(int a, int b){ return (a*b)%MOD; } void chsum(int &a, int b){ b%=MOD; a = (a+b)%MOD; } void chmul(int &a, int b){ b%=MOD; a = (a*b)%MOD; } void chsub(int &a, int b){ b %= MOD; a = (a+MOD-b)%MOD; } int expo(int a, int b){ if(b==0) return 1; int te = expo(a, b/2); te = mul(te, te); return (b%2 ? mul(te, a) : te); } int n, ANS; string s; set <string> m; signed main(){ cin >> n; cin >> s; s = '.'+s; if(n%2==0){ cout << "NOT POSSIBLE\n"; exit(0); } for(int i=1; i<=n; i++){ string x="", y=""; int cnt = 0; for(int j=1; j<=n; j++){ if(i==j) continue; if(cnt<n/2) x += s[j]; else y += s[j]; cnt++; } if(x.size() != y.size()) assert(false); if(x==y){ m.insert(x); } } if(m.size()==0) cout << "NOT POSSIBLE\n"; else if(m.size()>=2) cout << "NOT UNIQUE\n"; else cout << *(m.begin()) << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...