Submission #1126400

#TimeUsernameProblemLanguageResultExecution timeMemory
1126400AgageldiThree Friends (BOI14_friends)C++20
0 / 100
1094 ms5348 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]; string s, g; vector <string> v, h; int main () { ios::sync_with_stdio(0);cin.tie(0); cin >> n >> s; if(n%2 == 0) { cout << "NOT POSSIBLE\n"; return 0; } for(int i = 0; i < n;i++) { g = ""; v.clear(); for(int j = 0;j<n;j++) { if(j == i) continue; g += s[j]; if(sz(g) == (n - 1) / 2) { v.pb(g); g = ""; } } if(v[0] == v[1]) h.pb(v[0]); } if(!sz(h)) { cout << "NOT POSSIBLE\n"; return 0; } if(sz(h) > 1) { cout << "NOT UNIQUE\n"; return 0; } cout << h[0] << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...