# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
592124 | JJAnawat | Combo (IOI18_combo) | C++14 | 32 ms | 696 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>
#include "combo.h"
using namespace std;
string button[4]={"A","B","X","Y"};
string guess_sequence(int N){
string ans="";
if(press("AB")){
ans=(press("A"))?"A":"B";
}
else{
ans=(press("X"))?"X":"Y";
}
if(N==1)
return ans;
vector<string> rd;
for(int i=0;i<4;i++){
if(button[i]!=ans)
rd.push_back(button[i]);
}
for(int i=1;i<N-1;i++){
int scr=press(ans+rd[0]+ans+rd[1]+rd[0]+ans+rd[1]+rd[1]+ans+rd[1]+rd[2]);
//AB AXB AXY AXZ
//else AY
int sz=ans.size();
if(scr==sz+1)
ans+=rd[0];
else if(scr==sz+2)
ans+=rd[1];
else
ans+=rd[2];
}
if(press(ans+rd[0]+ans+rd[1])==ans.size()+1){
if(press(ans+rd[0])-ans.size())
ans+=rd[0];
else
ans+=rd[1];
}
else
ans+=rd[2];
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |