# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1117080 | Bula | Password (RMI18_password) | C++17 | 504 ms | 1628 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 p);
string guess(int n, int s){
string t;
set<pair<int, string>> st;
for(char c = 'a'; c <= 'a' + s - 1; c++){
string p;
for(int i = 0; i < n; i++) p += c;
int x = query(p);
if(x == 0) continue;
p.clear();
for(int i = 0; i < x; i++) p += c;
st.insert({p.size(), p});
}
while(st.size() > 1){
pair<int, string> pr = *st.begin();
st.erase(st.begin());
string a = pr.second;
pr = *st.begin();
st.erase(st.begin());
string b = pr.second, ans;
while(a.size() > 0){
string p = ans;
p += a[0]; p += b;
if(query(p) == p.size()){
ans += a[0];
a.erase(a.begin());
}else{
ans += b[0];
b.erase(b.begin());
}
}
ans += b;
st.insert({ans.size(), ans});
}
pair<int, string> pr = *st.begin();
return pr.second;
}
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... |