# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
583931 | LIF | Combo (IOI18_combo) | C++14 | 1 ms | 208 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<bits/stdc++.h>
std::string guess_sequence(int N) {
std::string p = "";
int n = N;
char k[4] = {'A','B','X','Y'};
int first=999;
for(int i=0;i<3;i++)
{
std:: string ss = p;
ss = ss + k[i];
int kk = press(ss);
if(kk == 1)
{
first = i;
break;
}
}
int check1,check2;
if(first == 999 )//that means first haven't been changed
{
first = 3;
}
p = p + k[first];
for (int i = 1; i < n-1;i++)
{
std::string tt = p;
std::string ss="";
int kk = 0;
for(int j = 0;j < 3; j++)
{
tt = p;
if(j == first)continue;
if(kk == 0)
{
check1 = j;
tt += k[j];
ss += tt;
}
else
{
check2 = j;
tt += k[j];
std::string xxx= tt;
for(int pk=0;pk<4;pk++)
{
if(pk==first)continue;
tt = xxx + k[pk];
ss+= tt;
}
}
kk++;
}
int ans= press(ss);
if(ans == i+1)
{
p = p + k[check1];
}
else
{
if(ans == i+2)
{
p = p+k[check2];
}
else
{
for(int j=0;j<4;j++)
{
if(j!=check1&&j!=check2&&j!=first)
{
p = p + k[j];
}
}
}
}
}
int flag=0;
for(int j=0;j<3;j++)
{
std::string ss = p;
if(j == first )continue;
ss += k[j];
if(press(ss) == n)
{
flag=1;
p = p+k[j];
break;
}
}
if(flag==0)
{
p = p + k[3];
}
return p;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |