# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
755952 | MohamedFaresNebili | Password (RMI18_password) | C++14 | 1371 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 guess(int n, int s) {
string S(n, 'a');
int freq[s]{0};
vector<pair<int, int>> v;
for(int l = 0; l < s; l++) {
for(int i = 0; i < n; i++)
S[i] = char('a' + l);
freq[l] = query(S);
v.push_back({freq[l], l});
}
sort(v.begin(), v.end());
S = "";
for(int l = 0; l < v[0].first; l++)
S += char('a' + v[0].second);
for(int _ = 1; _ < s; _++) {
int l = v[_].second;
for(int i = 0, last = 0; i < freq[l]; i++) {
for(;; last++) {
string str = "";
for(int e = 0; e < last; e++) str.push_back(S[e]);
str.push_back(char('a' + l));
for(int e = last; e < S.size(); e++)
str.push_back(S[e]);
if(query(str) == str.size()) {
S = str; last++; break;
}
}
}
}
return S;
}
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... |