| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 101524 | daniel920712 | Combo (IOI18_combo) | C++14 | 1 ms | 256 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 <string>
#include <stdio.h>
#include <iostream>
#include "combo.h"
using namespace std;
string all;
string aaa;
bool have[4]={0};
bool can[5][2005]={0};
char change1[4][4]={"A","B","X","Y"};
char change[4]={'A','B','X','Y'};
string guess_sequence(int N)
{
int con=0,i,j,k,t,x=0,a,b;
for(i=0;i<N;i++)
{
if(i==0)
{
t=press("AB");
if(t==1)
{
if(t==2)
{
all+="AB";
i++;
}
else
{
t=press("A");
if(t)
{
all+='A';
can[1][1]=1;
}
else all+='B';
}
}
else
{
t=press("X");
if(t) all+='X';
else all+='Y';
}
continue;
}
t=0;
con=0;
for(j=0;j<4;j++)
{
if(i==1&&change[j]==all[0]) for(k=i;k<N;k++) can[j][k]=1;
t+=(1-can[j][i]);
}
for(j=0;j<4;j++)
{
if(can[j][i]) continue;
if(con+1==t) all+=change[j];
else
{
con++;
a=-1;
b=-1;
for(k=0;k<4;k++)
{
if(can[k][i+1]) continue;
if(a==-1&&(i||j!=k)) a=k;
}
aaa=all;
aaa+=change[j];
aaa+=change[a];
x=press(aaa);
if(x==i+1)
{
all+=change[j];
can[a][i+1]=1;
break;
}
else if(x==i+2)
{
all+=change[j];
all+=change[a];
i++;
break;
}
}
}
}
return all;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
