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"
#pragma GCC optimize("O3")
using namespace std;
string guess_sequence(int N){
string p, t, test;
int ans;
if(press("AB")){
if(press("A")) p = "A", t = "BXY";
else p = "B", t = "AXY";
}
else{
if(press("X")) p = "X", t = "ABY";
else p = "Y", t = "ABX";
}
if(N == 1) return p;
for(int i = 1; i < N-1; i++){
test = p; test += t[0];
test += p; test += t[1]; test += t[0];
test += p; test += t[1]; test += t[1];
test += p; test += t[1]; test += t[2];
ans = press(test)-i;
if(ans == 2) p += t[1];
else if(ans) p += t[0];
else p += t[2];
}
p += t[0];
if(press(p) != N){
p.pop_back();
p += t[1];
if(press(p) != N) p.pop_back(), p += t[2];
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |