# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
713100 | dungnguyenn_05 | Combo (IOI18_combo) | C++17 | 55 ms | 580 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>
#define fs first
#define sc second
#define pb push_back
#define all(x) x.begin()x.end()
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pi;
char c[5]={'A','B','X','Y'};
vi ava;
std::string guess_sequence(int N) {
int start;
string ask;
//////////////////////
ask+=c[0];
ask+=c[1];
int val=press(ask);
if(val)
{
ask="";
ask+=c[0];
val=press(ask);
if(val)
start=0;
else
start=1;
}
else
{
ask="";
ask+=c[2];
val=press(ask);
if(val)
start=2;
else
start=3;
}
string cur;
cur+=c[start];
for(int i=0;i<4;i++)
if(i!=start)
ava.pb(i);
while(cur.size()<N-1)
{
// cout<<"cur "<<cur<<endl;
string ask;
///////////////////
ask+=cur;
ask+=c[ava[0]];
///////////////////
ask+=cur;
ask+=c[ava[1]];
ask+=c[ava[0]];
///////////////////
ask+=cur;
ask+=c[ava[1]];
ask+=c[ava[1]];
///////////////////
ask+=cur;
ask+=c[ava[1]];
ask+=c[ava[2]];
///////////////////
int val=press(ask)-cur.size();
// cout<<ask<<' '<<val<<endl;
if(!val)
cur+=c[ava[2]];
if(val==1)
cur+=c[ava[0]];
if(val==2)
cur+=c[ava[1]];
}
if(cur.size()<N)
{
string ask;
ask=cur+c[ava[0]];
if(press(ask)-cur.size()>0)
cur+=c[ava[0]];
ask=cur+c[ava[1]];
if(press(ask)-cur.size()>0)
cur+=c[ava[1]];
}
if(cur.size()<N)
cur+=c[ava[2]];
// cout<<cur<<endl;
return cur;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |