# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
96081 | bogdan10bos | Combo (IOI18_combo) | C++14 | 1 ms | 328 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>
#include "combo.h"
using namespace std;
const char ltr[] = {'A', 'B', 'X', 'Y'};
vector<char> can[2005];
string guess_sequence(int N)
{
char start = 0;
if(press("AB"))
{
if(press("A")) start = 'A';
else start = 'B';
}
else
{
if(press("X")) start = 'X';
else start= 'Y';
}
string pfx = "";
pfx += start;
vector<char> l;
for(int i = 0; i < 4; i++)
if(ltr[i] != start) l.push_back(ltr[i]);
for(int i = 1; i < N; i++)
{
string qry = (pfx + l[0]) + (pfx + l[1] + l[0]) + (pfx + l[1] + l[1]) + (pfx + l[1] + l[2]);
int prs = press(qry);
if(prs == 0) pfx += l[2];
else if(prs == 1) pfx += l[0];
else pfx += l[1];
}
if(press(pfx + l[0] + pfx + l[1]) == pfx.size()) pfx += l[2];
else
{
if(press(pfx + l[0]) == pfx.size()) pfx += l[1];
else pfx += l[0];
}
return pfx;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |