# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
592804 | Summers | Combo (IOI18_combo) | C++14 | 1 ms | 272 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<iostream>
using namespace std;
std::string guess_sequence(int n) {
string s,s1;
long long br=1,le=0;
char cc;
char m[10]={'A','B','X','Y'};
if(press("XY"))
{
if(press("X")){s="X";cc='X';}
else {s="Y";cc='Y';}
}
else if(press("A")){s="A";cc='A';}
else {s="B";cc='B';}
char c[2];
for(int i=0;i<=3;i++)
{
if(m[i]!=cc)c[le++]=m[i];
}
while(br<n-1)
{
s1=s+c[0]+c[1]+s+c[0]+c[0]+s+c[0]+c[2]+s+c[1];
long long is=press(s1);
if(is==br){s=s+c[2];br++;continue;}
if(is==br+1){s=s+c[1];br++;continue;}
s=s+c[0];br++;continue;
}
if(press(s+c[0])==br+1)s+=c[0];
else if(press(s+c[1])==br+1)s+=c[1];
else s+=c[2];
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |