This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#ifndef NOTSUBMIT
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
#endif
string guess_sequence(int N) {
string ans = "";
char c1='A', c2='B', c3='X';
if (press("AB") != 0){
if (press("A") != 0){ ans += "A"; c1='Y'; }
else{ ans += "B"; c2='Y'; }
}
else{
if (press("X") != 0){ ans += "X"; c3='Y'; }
else{ ans += "Y"; }
}
if (N == 1){ return ans; }
for (int i = 2; i < N; i++){
int res = press(ans+c1+c1 + ans+c1+c2 + ans+c1+c3 + ans+c2);
if (res >= i+1){ ans += c1; }
else if (res == i){ ans += c2; }
else{ ans += c3; }
}
if (press(ans+c1) == N){ return ans+c1; }
else if (press(ans+c2) == N){ return ans+c2; }
else{ return ans+c3; }
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |