# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
848798 | TahirAliyev | Password (RMI18_password) | C++17 | 1 ms | 444 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 a, q;
vector<string> v;
string merge(string& a, string& b){
int p1 = 0, p2 = 0;
while(p1 <= a.size() && p2 < b.size()){
q = a;
q.insert(q.begin() + p1, b[p2]);
if(query(q) == q.size()){
a = q;
p2++;
}
else{
p1++;
}
}
return a;
}
bool comp(string& a, string& b){
return a.size() < b.size();
}
string guess(int n, int s){
for(char c = 'a'; c <= 'a' + s - 1; c++){
a = "";
for(int i = 1; i <= n; i++){
a += c;
}
int cnt = query(a);
a = "";
for(int i = 1; i <= cnt; i++){
a += c;
}
v.push_back(a);
}
sort(v.begin(), v.end(), comp);
while(v.size() != 1){
a = merge(v[0], v[1]);
v.erase(v.begin());
v.erase(v.begin() + 1);
v.push_back(a);
sort(v.begin(), v.end());
}
return v[0];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |