# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
770043 | teamariaa | Combo (IOI18_combo) | C++17 | 31 ms | 536 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 > 0)
{
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";
}
// cout << s << " " << letters << "\n";
for(int i = 2; i <= N - 1; i++)
{
string x;
x = s + letters[0] + s + letters[1] +letters[0] + s + letters[1] + letters[1] + s + letters[1] +letters[2];
int cost = press(x);
if(cost == s.size())
s += letters[2];
else if(cost == s.size() + 1)
s += letters[0];
else
s += letters[1];
// cout << s << "\n";
}
if(N > 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... |