# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
713096 | dungnguyenn_05 | Combo (IOI18_combo) | C++17 | 34 ms | 568 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=3;
for(int i=0;i<3;i++)
{
string s;
s+=c[i];
int val=press(s);
if(val)
{
start=i;
break;
}
}
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... |