제출 #1024371

#제출 시각아이디문제언어결과실행 시간메모리
1024371ByeWorld세 명의 친구들 (BOI14_friends)C++14
0 / 100
1057 ms8068 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, str; 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==y){ ANS++; str = x; } } if(ANS==0) cout << "NOT POSSIBLE\n"; else if(ANS>=2) cout << "NOT UNIQUE\n"; else cout << str << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...