| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 106200 | tictaccat | Combo (IOI18_combo) | C++14 | 81 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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
vector<char> chars {'A','B','X','Y'};
std::string guess_sequence(int N) {
srand(time(NULL));
string ans = "";
//find first character, 2.25 guesses
char firstChar = '#';
random_shuffle(chars.begin(),chars.end());
for (int i = 0; i < 3; i++) {
if (press(ans+chars[i]) > 0) {
firstChar = chars[i];
break;
}
}
if (firstChar == '#') firstChar = chars[3];
ans += firstChar;
//each character 5/3 guesses
while (ans.size() < N) {
char nextChar = '#';
random_shuffle(chars.begin(),chars.end());
for (int i = 0; i < 3; i++) {
if (chars[i] == firstChar) continue;
if (press(ans+chars[i]) > ans.size()) {
nextChar = chars[i];
break;
}
}
if (nextChar == '#') nextChar = chars[3];
ans += nextChar;
}
return ans;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
