# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
213163 | _Ice_Tea_ | Combo (IOI18_combo) | C++14 | 1 ms | 200 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"
#define de(x) if( x && x == MODE)
#define MODE 1
using namespace std;
string cht;
string dic[4];
std::string guess_sequence(int N) {
string S;
int i, j;
string p;
if( p = "AB", press(p) )
{
if( p = "A", press(p) )
S = "A";
else
S = "B";
}
else
{
if( p = "X", press(p))
S = "X";
else
S = "Y";
}
if( S == "A")
{
dic[0] = "BB";
dic[1] = "BX";
dic[2] = "BY";
dic[3] = "X";
cht = "BXY";
}
else if( S == "B")
{
dic[0] = "AA";
dic[1] = "AX";
dic[2] = "AY";
dic[3] = "X";
cht = "AXY";
}
else if( S == "X")
{
dic[0] = "AA";
dic[1] = "AB";
dic[2] = "AY";
dic[3] = "B";
cht = "ABY";
}
else if( S == "Y")
{
dic[0] = "AA";
dic[1] = "AB";
dic[2] = "AX";
dic[3] = "B";
cht = "ABX";
}
for( i=1; i<N-1; i++)
{
p = S + dic[0] + S + dic[1] + S + dic[2] + S + dic[3];
de(1) cout<<"ask>> "<<p<<"\n";
int q = press(p);
if( q == i + 2)
S.push_back(cht[0]);
else if( q == i + 1)
S.push_back(cht[1]);
else
S.push_back(cht[2]);
de(1) cout << "S = " << S << "\n";
}
p = S + cht[0] + S + cht[1];
if( press(p) == N)
{
p = S + cht[0];
if( press(p) == N)
S.push_back(cht[0]);
else
S.push_back(cht[1]);
}
else
{
S.push_back(cht[2]);
}
return S;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |