| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 201145 | Atill83 | Password (RMI18_password) | C++14 | 3057 ms | 636 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);
int freq[30];
string solve(int l, int r){
if(l == r){
string a;
for(int i = 0; i < freq[l]; i++) a += (char)('a' + l);
return a;
}
int m = (l + r) / 2;
string a = solve(l, m), b = solve(m + 1, r);
string ans;
reverse(a.begin(), a.end());
reverse(b.begin(), b.end());
while(a.length() && b.length()){
string soru = ans + a.back();
for(auto i = b.rbegin(); i < b.rend(); i++) soru = soru + (*i);
int quer = query(soru);
if(quer == soru.length()){
ans += a.back();
a.pop_back();
}else{
ans += b.back();
b.pop_back();
}
}
while(a.length()){
ans += a.back();
a.pop_back();
}
while(b.length()){
ans += b.back();
b.pop_back();
}
return ans;
}
string guess(int n, int s){
int sum = 0;
for(int i = 0; i < s - 1; i ++){
string que;
for(int j = 0; j < n; j++)
que += (char)('a' + i);
freq[i] = query(que);
sum += freq[i];
}
freq[s - 1] = n - sum;
return solve(0, s - 1);
}
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... | ||||
