# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
76582 | Xylofo | Combo (IOI18_combo) | C++14 | 53 ms | 576 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;
string guess_sequence(int N) {
string toL = "ABXY";
int fst = 0;
fst += press("BY") ? 1 : 0;
fst += press("XY") ? 2 : 0;
string pre = "";
pre += toL[fst];
toL.erase(toL.begin() + fst);
while(pre.size() + 2 <= N) {
string query = ""
+ pre + toL[0]
+ pre + toL[1] + toL[0]
+ pre + toL[1] + toL[1]
+ pre + toL[1] + toL[2];
int k = press(query);
if(k == pre.size()+0) pre += toL[2];
if(k == pre.size()+1) pre += toL[0];
if(k == pre.size()+2) pre += toL[1];
}
if(pre.size() != N) {
string query0 = pre + toL[0];
string query1 = pre + toL[1];
string query2 = pre + toL[2];
if(press(query0) == N) return query0;
if(press(query1) == N) return query1;
else return query2;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |