Submission #899820

#TimeUsernameProblemLanguageResultExecution timeMemory
899820CookiePassword (RMI18_password)C++14
100 / 100
171 ms1784 KiB
#include<bits/stdc++.h> #include<fstream> using namespace std; #define sz(a) (int)a.size() #define ALL(v) v.begin(), v.end() #define ALLR(v) v.rbegin(), v.rend() #define ll long long #define pb push_back #define forr(i, a, b) for(int i = a; i < b; i++) #define dorr(i, a, b) for(int i = a; i >= b; i--) #define ld long double #define vt vector #include<fstream> #define fi first #define se second #define pll pair<ll, ll> #define pii pair<int, int> #define mpp make_pair int query(string s); bool cmp(string a, string b){ return(sz(a) > sz(b)); } vt<string>v; string guess(int n, int s){ for(int i = 0; i < s; i++){ string s = ""; while(1){ s += (i + 'a'); if(query(s) != sz(s)){ s.pop_back(); break; } } if(s != "")v.pb(s); } //for(auto i: v)cout << i << " "; while(sz(v) > 1){ sort(ALL(v), cmp); string s1 = v.back(), s2 = v[sz(v) - 2]; int l1 = 0, l2 = 0; string s3 = ""; while(l1 < sz(s1) || l2 < sz(s2)){ if(l1 == sz(s1))s3 += s2[l2++]; else if(l2 == sz(s2))s3 += s1[l1++]; else{ string s4 = s3 + s1[l1]; for(int i = l2; i < sz(s2); i++)s4 += s2[i]; if(query(s4) == sz(s4)){ s3 += s1[l1++]; }else{ s3 += s2[l2++]; } } } v.pop_back(); v.pop_back(); v.pb(s3); } return(v[0]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...