제출 #931241

#제출 시각아이디문제언어결과실행 시간메모리
931241PlayVoltz세 명의 친구들 (BOI14_friends)C++17
0 / 100
1061 ms6876 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> 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 int32_t main(){ 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 (can&&can2)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...