# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
769919 | teamariaa | Combo (IOI18_combo) | C++17 | 1 ms | 208 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 s, letters;
int cost = press("AB");
if(cost == 1)
{
cost = press("A");
if(cost == 1)
s += 'A', letters += "BXY";
else
s += 'B', letters += "AXY";
}
else
{
cost = press("X");
if(cost == 1)
s += 'X', letters += "ABY";
else
s += 'Y', letters += "ABX";
}
for(int i = 2; i <= N - 1; i++)
{
string idk = s;
idk = idk + letters[0] + idk + letters[1] +letters[0] + idk + letters[1] + letters[1] + idk + letters[1] +letters[2];
int cost = press(idk);
if(cost == idk.size())
s += letters[2];
else if(cost == idk.size() + 1)
s += letters[0];
else
s += letters[1];
}
string idk = s;
if(press(idk + letters[0]) == N)
s += letters[0];
else if(press(idk + letters[1]) == N)
s += letters[1];
else
s += letters[2];
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |