# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
848780 | TahirAliyev | Password (RMI18_password) | C++17 | 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>
#include "grader.cpp"
using namespace std;
vector<string> v;
string merge(string a, string b){
int p1 = 0, p2 = 0;
while(p1 <= a.size() && p2 < b.size()){
string q = a;
q.insert(q.begin() + p1, b[p2]);
if(query(q) == q.size()){
a = q;
p2++;
}
else{
p1++;
}
}
return a;
}
string guess(int n, int s){
for(char c = 'a'; c <= 'a' + s - 1; c++){
string s = "";
for(int i = 1; i <= n; i++){
s += c;
}
int cnt = query(s);
s = "";
for(int i = 1; i <= cnt; i++){
s += c;
}
v.push_back(s);
}
string main = v[0];
for(int i = 1; i < v.size(); i++){
main = merge(main, v[i]);
}
return main;
}