# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
709141 | salmon | Password (RMI18_password) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
//int query(string str);
string guess(int N, int S){
string aas = "";
for(int i = 1; i <= N - 30; i++){
int s = 'a';
int e = 'a' + S - 1;
while(s != e){
int m = (s + e)/2;
string temp = aas;
for(int i = s; i <= m; i++){
temp.push_back(s);
}
if(query(temp) >= i){
e = m;
}
else{
s = m + 1;
}
}
aas.push_back(s);
}
for(int i = max(1,N - 29); i <= N; i++){
int s = 'a';
int e = 'a' + S - 1;
for(char j = s; j <= e; j++){
aas.push_back(j);
if(query(aas) == i){
break;
}
else{
aas.pop_back();
}
}
}
return aas;
}