제출 #1126421

#제출 시각아이디문제언어결과실행 시간메모리
1126421Agageldi세 명의 친구들 (BOI14_friends)C++20
0 / 100
16 ms7228 KiB
/* ID: agageld1 LANG: C++17 TASK: */ #include <bits/stdc++.h> using namespace std; #define ll long long #define N 400005 #define ff first #define ss second #define pb push_back #define sz(s) (int)s.size() #define rep(c, a, b) for(c = a; c <= b; c++) //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); ll n, t, a[N], p = 0; string s, g, ans; void solve(string h) { int cnt = 0, tr = 0; for(int i = 0; i < sz(s); i++) { if(h[cnt] == s[i]) cnt++; else { tr++; if(tr == 2) break; } } if(tr <= 1) p++; } int main () { ios::sync_with_stdio(0);cin.tie(0); cin >> n >> s; if(n % 2 == 0) { cout << "NOT POSSIBLE"; return 0; } for(int i = 0; i <n/2; i++) { g += s[i]; } solve(g + g); if(p) ans = g; g = ""; for(int i = n/2 + 1; i < n; i++) { g += s[i]; } solve(g + g); if(p) ans = g; if(!p) return cout << "NOT POSSIBLE\n", 0; if(p == 2)cout << "NOT UNIQUE\n"; else cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...