이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |