| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 293629 | shrek12357 | Combo (IOI18_combo) | C++14 | 1 ms | 200 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 <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <cmath>
#include <fstream>
#include <queue>
#include "combo.h"
using namespace std;
string guess(string cur, string c1, string c2, string c3) {
string temp = cur + c1 + cur + c2 + c1 + cur + c2 + c2 + cur + c2 + c3;
int val = press(temp);
if (val == cur.size()) {
return cur + c3;
}
if (val == cur.size() + 1) {
return cur + c1;
}
return cur + c2;
}
string guess_sequence(int n) {
string ans = "";
bool a = false, b = false, x = false, y = false;
if (press("AB") != 0) {
if (press("A") == 1) {
ans += "A";
a = true;
}
else {
ans += "B";
b = true;
}
}
else {
if (press("X") == 1) {
ans += "X";
x = true;
}
else {
ans += "Y";
y = true;
}
}
for (int i = 1; i < n - 1; i++) {
if (a) {
ans = guess(ans, "B", "X", "Y");
}
if (b) {
ans = guess(ans, "A", "X", "Y");
}
if (x) {
ans = guess(ans, "A", "B", "Y");
}
if (y) {
ans = guess(ans, "A", "B", "Y");
}
}
if (press(ans + "A" + ans + "B") == n) {
if (press(ans + "A") == n) {
return ans + "A";
}
return ans + "B";
}
else {
if (press(ans + "X") == n) {
return ans + "X";
}
return ans + "Y";
}
}Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
