제출 #931247

#제출 시각아이디문제언어결과실행 시간메모리
931247PlayVoltz세 명의 친구들 (BOI14_friends)C++17
0 / 100
1041 ms5120 KiB
#include <iostream> #include <map> #include <vector> #include <climits> #include <stack> #include <string> #include <queue> #include <algorithm> #include <set> #include <unordered_set> #include <iostream> #include <unordered_map> #include <cmath> #include <cctype> #include <bitset> #include <iomanip> #include <cstring> #include <bits/stdc++.h> using namespace std; #define int long long #define pii pair<int, int> #define mp make_pair #define pb push_back #define fi first #define se second #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") int32_t main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; string s, a="", b=""; cin>>n>>s; for (int i=0; i<n/2; ++i)a+=s[i]; for (int i=n-1; i>n-n/2-1; --i)b=s[i]+b; bool one=1, can=1, can2=1; int p=0; for (int i=0; i<1+(n-1)/2; ++i){ if (b[p]==s[i])++p; else if (one)one=0; else {can=0;break;} } one=1; p=0; for (int i=n/2; i<n; ++i){ if (a[p]==s[i])++p; else if (one)one=0; else {can2=0;break;} } if (!(n%2))cout<<"NOT POSSIBLE"; else if (can&&can2&&n>=9)cout<<"NOT UNIQUE"; else if (can)cout<<b; else if (can2)cout<<a; else cout<<"NOT POSSIBLE"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...