# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
156288 | a_player | Combo (IOI18_combo) | C++14 | 52 ms | 532 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 <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
int press(string p);
string c[4];
vector<string> v;
string guess_sequence(int N){
string s="";
c[0]="A";
c[1]="B";
c[2]="X";
c[3]="Y";
int pos=-1;
int x=press("AB");
if(x){
x=press("A");
if(x==1){
pos=0;
s+="A";
}else{
pos=1;
s+="B";
}
}else{
x=press("X");
if(x==1){
pos=2;
s+="X";
}else{
pos=3;
s+="Y";
}}
for(int i=0;i<4;i++)if(pos!=i)v.push_back(c[i]);
for(int i=1;i<N-1;i++){
stringstream ss;
ss<<s<<v[0]<<s<<v[1]<<v[0]<<s<<v[1]<<v[1]<<s<<v[1]<<v[2];
int a=press(ss.str());
if(a==(int)s.size()+1)s+=v[0];
else if(a==(int)s.size()+2)s+=v[1];
else s+=v[2];
}
if(N>1){
int a=press(s+v[0]);
if(a==s.size()+1)return s+v[0];
a=press(s+v[1]);
if(a==s.size()+1)return s+v[1];
return s+v[2];}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |