| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 139899 | vince | Combo (IOI18_combo) | C++14 | 2 ms | 308 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 "combo.h"
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
string C;
string guess_sequence(int N)
{
string S = "";
int a = press("AX");
int b = press("BY");
if(a)
{
int x = press("A");
if(x) S = "A", C = "BXY";
else S = "X", C = "ABY";
}
if(b)
{
int x = press("B");
if(x) S = "B", C = "AXY";
else S = "Y", C = "ABX";
}
while(1)
{
string T = S + C.substr(0,1);
for(int i = 0; i < 3; i++)
{
T += S + C.substr(1,1) + C.substr(i, 1);
}
int val = press(T);
if(val == S.size()+1)
S += C.substr(0,1);
else if(val == S.size()+2)
S += C.substr(1,1);
else
S += C.substr(2,1);
// cout << S << "\n";
if(S.size() == N-1)
break;
}
string T = S + C.substr(0,1) + S + C.substr(1,1);
int x = press(T);
if(x == N)
{
if(press(S + C.substr(0,1)) == N)
return S + C.substr(0,1);
else return S + C.substr(1,1);
}
else return S + C.substr(2,1);
return S;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
