# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
709737 | siewjh | Password (RMI18_password) | C++17 | 245 ms | 688 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 q);
string chain(char ch, int x){
string str = "";
for (int i = 0; i < x; i++) str += ch;
return str;
}
string guess(int n, int s){
priority_queue<pair<int, string>> pq;
for (int i = 0; i < s; i++){
char ch = 'a' + i;
int amt = query(chain(ch, n));
pq.push({-amt, chain(ch, amt)});
}
while (pq.size() >= 2){
string s1, s2;
s1 = pq.top().second; pq.pop();
s2 = pq.top().second; pq.pop();
string mrg = "";
while (!s1.empty() && !s2.empty()){
if (query(mrg + s1[0] + s2) == mrg.size() + 1 + s2.size()){
mrg += s1[0];
s1.erase(0, 1);
}
else{
mrg += s2[0];
s2.erase(0, 1);
}
}
if (!s1.empty()) mrg += s1;
else mrg += s2;
pq.push({-mrg.size(), mrg});
}
return pq.top().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... |