제출 #105641

#제출 시각아이디문제언어결과실행 시간메모리
105641thiago4532세 명의 친구들 (BOI14_friends)C++17
35 / 100
1063 ms8360 KiB
#include <bits/stdc++.h> #define subs(a, b) substr(a, b-a+1) using namespace std; int main() { int n; cin >> n; if(n%2 == 0){ cout << "NOT POSSIBLE\n"; return 0; } string str; cin >> str; string resp = "NOT POSSIBLE"; for(int i=0;i<n;i++){ string x; for(int j=0;j<n;j++) if(j != i) x += str[j]; int k = x.size(); if(x.subs(0, k/2 - 1) == x.subs(k/2, k-1)){ if(resp != "NOT POSSIBLE" && resp != x.subs(0, k/2 - 1)){ cout << "NOT UNIQUE\n"; return 0; } resp = x.subs(0, k/2 - 1); } } cout << resp << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...