# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
294605 | Autoratch | Combo (IOI18_combo) | C++14 | 32 ms | 676 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 guess_sequence(int n)
{
string ans,ch = "ABXY",tmp;
if(press("XY"))
{
if(press("X")) ans = "X";
else ans = "Y";
}
else
{
if(press("A")) ans = "A";
else ans = "B";
}
if(n==1) return ans;
for(char c : ch) if(c!=ans[0]) tmp+=c;
ch = tmp;
for(int i = 1;i < n-1;i++)
{
tmp = ans+ch[0]+ch[0]+ans+ch[0]+ch[1]+ans+ch[0]+ch[2]+ans+ch[1];
int ret = press(tmp);
if(ret==ans.length()+2) ans+=ch[0];
else if(ret==ans.length()+1) ans+=ch[1];
else ans+=ch[2];
}
if(press(ans+ch[0])==n) return ans+ch[0];
else if(press(ans+ch[1])==n) return ans+ch[1];
else return ans+ch[2];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |