# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
464087 | Mamedov | Password (RMI18_password) | C++17 | 481 ms | 284 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.
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define ll long long
#define ui unsigned int
#define pii pair<int, int>
#define piii pair<int, pii>
#define pb push_back
#define f first
#define s second
#define oo (1ll << 60)
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int query(string str);
string guess(int n, int s) {
string str;
vector<int>countLetter(s);
int maxLetter = 0;
for(int i = 0; i < s; ++i) {
str = "";
for(int j = 0; j < n; ++j) {
str += ('a' + i);
}
countLetter[i] = query(str);
if(countLetter[i] > countLetter[maxLetter]) {
maxLetter = i;
}
}
str = "";
for(int i = 0; i < countLetter[maxLetter]; ++i) {
str += ('a' + maxLetter);
}
for(int i = 0; i < s; ++i) {
if(i == maxLetter) continue;
for(int j = 0; j < countLetter[i]; ++j) {
for(int k = 0; k <= str.length(); ++k) {
str.insert(str.begin() + k, 'a' + i);
if(query(str) == str.length()) {
break;
}
str.erase(str.begin() + k);
}
}
}
return str;
}
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... |