# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
285423 | Pichon5 | Combo (IOI18_combo) | C++17 | 40 ms | 652 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 pb push_back
using namespace std;
string guess_sequence(int N){
vector<char>v;
char arr[4]={'A','B','X','Y'};
int c=0;
string s="",ss;
if(press("X")==1){
s+='X';
}else{
if(press("Y")==1){
s+='Y';
}else{
if(press("A")==1){
s+='A';
}else{
s+='B';
}
}
}
for(int i=0;i<4;i++){
if(arr[i]!=s[0]){
v.pb(arr[i]);
}
}
for(int i=2;i<=N;i++){
ss=s;
if(i==N){
ss+=v[0];
if(press(ss)==i){
s=ss;
break;
}
ss=s+v[1];
if(press(ss)==i){
s=ss;
break;
}
s+=v[2];
break;
}
ss=ss+v[0]+ss+v[1]+v[0]+ss+v[1]+v[1]+ss+v[1]+v[2];
int x=press(ss);
if(x==i){
s+=v[0];
continue;
}
if(x==i+1){
s+=v[1];
continue;
}
s+=v[2];
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |