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 head = "";
string str = "";
str = "AB";
char lead;
if (press(str)){
str = "A";
if (press(str)){
head = "A";
lead = 'A';
} else{
head = "B";
lead = 'B';
}
} else {
str = "X";
if (press(str)){
head = "X";
lead = 'X';
} else {
head = "Y";
lead = 'Y';
}
}
string a, b, c;
if (lead == 'A'){
a = "B";
b = "X";
c = "Y";
} else if (lead == 'B'){
a = "A";
b = "X";
c = "Y";
} else if (lead == 'X'){
a = "B";
b = "A";
c = "Y";
} else if (lead == 'Y'){
a = "B";
b = "X";
c = "A";
} else cout << "FATAL_ERROR1_";
for (int i = 1; i < N-1; i++){
/*str = "";
str += head;
str += a;
str += a;
str += head;
str += a;
str += b;
str += head;
str += a;
str += c;
str += head;
str += b;*/
str = head + a + a + head + a + b + head + a + c + head + b;
int coins = press(str);
if (coins == i+2) head += a;
else if (coins == i+1) head += b;
else if (coins == i) head += c;
else cout << "FATAL_ERROR2_";
}
/*str = "";
str += head;
str += a;
str += head;
str += b;*/
str = head + a + head + b;
int coin = press(str);
if (coin == N-1){
head += c;
} else if (coin == N){
str = head + a;
if (press(str) == N-1) head += b;
else if (press(str) == N) head += a;
else cout << "FATAL_ERROR4_";
} else cout << "FATAL_ERROR3_";
return head;
}
/*
string p = "";
for (int i = 0; i < 4 * N; ++i) {
p += 'A';
}
int coins = press(p);
string S = "";
for (int i = 0; i < N; ++i) {
S += 'A';
}
return S;
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |