# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
615597 | Shithila | Combo (IOI18_combo) | C++14 | 73 ms | 480 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>
using namespace std;
std::string guess_sequence(int N) {
std::string p = "";
int len=0;
string letter[4]={"A","B","X","Y"};
int first=3;
for(int i=0;i<3;i++)
{
string pas=p+letter[i];
if(press(pas)==1)
{
first=i;
p=pas;
break;
}
}
if(first==3) p=p+letter[3];
for(int j=1;j<N;j++)
{
if(first==3)
{
int second=2;
for(int i=0;i<2;i++)
{
string pas=p+letter[i];
if(press(pas)==j+1)
{
second=i;
p=pas;
break;
}
}
if(second==2) p=p+letter[2];
}
else
{
int second=first+1;
for(int i=0;i<second-1;i++)
{
string pas=p+letter[i];
//cout<<"x"<<endl;;
if(press(pas)==j+1)
{
//cout<<second<<" "<<i<<endl;;
second=i;
p=pas;
break;
}
}
if(second!=first+1)
{
continue;
}
for(int i=second+1;i<4;i++)
{
string pas=p+letter[i];
if(press(pas)==j+1)
{
second=i;
p=pas;
break;
}
}
if(second==first+1) p=p+letter[first+1];
}
}
//cout<<p<<endl;
return p;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |