제출 #990725

#제출 시각아이디문제언어결과실행 시간메모리
990725Khanhcsp2세 명의 친구들 (BOI14_friends)C++14
0 / 100
14 ms8284 KiB
#include <bits/stdc++.h> #define el '\n' #define fi first #define sc second #define int ll #define pii pair<int, int> #define all(v) v.begin(), v.end() using namespace std; using ll=long long; using ull=unsigned long long; using ld=long double; const int mod=1e9+7; const int N=1e5+11; string s, s1="", s2=""; int n; void sol() { cin >> n >> s; s=" "+s; if(n%2==0) { cout << "NOT POSSIBLE"; return; } else { int i=1, j=n/2+2, ans=0, ch=0; // cout << s[i] << ' ' << s[j] << el; while(i<=n/2+1) { if(ch==2) break; if(s[i]==s[j]) s1+=s[i], i++, j++; else i++, ch++; } if(ch<=1) ans++; // cout << s1 << el; i=1, j=n/2+1, ch=0; while(i<=n/2) { if(ch==2) break; if(s[i]==s[j]) s2+=s[j], i++, j++; else j++, ch++; } if(ch<=1) ans++; if(ans==0) cout << "NOT POSSIBLE"; else if(ans==1) cout << s1; else cout << "NOT UNIQUE"; } } signed main() { // freopen("divisor.INP", "r", stdin); // freopen("divisor.OUT", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(0); int t=1; //cin >> t; while(t--) { sol(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...