Submission #858077

#TimeUsernameProblemLanguageResultExecution timeMemory
858077alexddPassword (RMI18_password)C++17
80 / 100
520 ms2044 KiB
#include<bits/stdc++.h> using namespace std; int query(string str); string tostr(int x, int cnt) { string cv = ""; for(int i=0;i<cnt;i++) cv.push_back((char)('a'+x)); return cv; } pair<int,int> v[30]; string guess(int n, int s) { string aux; for(int i=0;i<s;i++) { aux = tostr(i, n); v[i]={query(aux), i}; } sort(v,v+s); string rez=""; for(int i=0;i<s;i++) { int cnt = v[i].first; int x = v[i].second; if(cnt==0) continue; if((int)rez.size()==0) { rez = tostr(x, cnt); continue; } string newrez=""; int nr = query(rez + tostr(x, n - (int)rez.size())) - (int)rez.size(); newrez = newrez + tostr(x, nr); int suff = nr; for(int j=(int)rez.size()-1;j>=0;j--) { int nr = (query(rez.substr(0,j) + tostr(x, n - (int)rez.size())) - j) - suff; newrez = newrez + rez[j] + tostr(x, nr); suff = nr + suff; } reverse(newrez.begin(),newrez.end()); rez = newrez; } return rez; }
#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...