# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
468103 | jjj | Combo (IOI18_combo) | C++14 | 39 ms | 648 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;
string guess_sequence(int N) {
string p = "AB";
string s = "", a = "", b = "", c = "";
int coins = press(p);
if(coins >= 1)
{
p = "A";
coins = press(p);
if(coins == 1)
{
s += 'A';
a += 'B';
b += 'X';
c += 'Y';
}
else
{
s += 'B';
a += 'A';
b += 'X';
c += 'Y';
}
}
else
{
p = "X";
coins = press(p);
if(coins == 1)
{
s += 'X';
a += 'B';
b += 'A';
c += 'Y';
}
else
{
s += 'Y';
a += 'B';
b += 'X';
c += 'A';
}
}
for (int i = 0; i < N - 2; i++)
{
p = "";
p += s + a + a + s + a + b + s + a + c + s + b;
coins = press(p);
if(coins == i + 1) s += c;
if(coins == i + 2) s += b;
if(coins == i + 3) s += a;
}
if(s.length() < N)
{
if(press(s + a) == N) s += a;
else if(press(s + b) == N) s += b;
else if(press(s + c) == N) s += c;
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |