# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
132472 | nxteru | Combo (IOI18_combo) | C++14 | 2 ms | 256 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;
string ans;
char c[3],d[4]={'A','B','X','Y'};
bool u[4];
string q;
string guess_sequence(int n){
q+=d[0];
q+=d[1];
if(press(q)==1){
q.pop_back();
if(press(q)==1)u[0]=true;
else u[1]=true;
}else{
q.clear();
q.push_back(d[2]);
if(press(q)==1)u[2]=true;
else u[3]=true;
}
int k=0;
for(int i=0;i<4;i++){
if(!u[i])c[k++]=d[i];
else ans.push_back(d[i]);
}
for(int i=2;i+1<=n;i++){
q.clear();
q+=ans;
q.push_back(c[0]);
for(int j=0;j<3;j++){
q+=ans;
q.push_back(c[1]);
q.push_back(c[j]);
}
int s=press(q);
if(s==n-1)ans.push_back(c[2]);
else if(s==n)ans.push_back(c[0]);
else ans.push_back(c[1]);
}
if(ans.size()==n)return ans;
q.clear();
q+=ans;
q.push_back(c[0]);
q+=ans;
q.push_back(c[1]);
if(press(q)==n){
q.clear();
q+=ans;
q.push_back(c[0]);
if(press(q)==n)ans.push_back(c[0]);
else ans.push_back(c[1]);
}else{
q.clear();
q+=ans;
q.push_back(c[2]);
if(press(q)==n)ans.push_back(c[2]);
else ans.push_back(c[3]);
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |