# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
133180 | nxteru | Combo (IOI18_combo) | C++14 | 67 ms | 536 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==i-1)ans.push_back(c[2]);
else if(s==i)ans.push_back(c[0]);
else ans.push_back(c[1]);
}
if(ans.size()==n){
ans.push_back('\0');
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 ans.push_back(c[2]);
ans.push_back('\0');
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |