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;
std::string guess_sequence(int N) {
vector<char> c = {'A', 'B', 'X', 'Y'};
string s = "";
int coins = 1;
if(press(s + c[0] + c[1]) > 0){
if(press(s + c[0]) > 0) {
s = c[0];
c.erase(c.begin());
}
else {
s = c[1];
c.erase(c.begin() + 1);
}
} else {
if(press(s + c[2]) > 0) {
s = c[2];
c.erase(c.begin() + 2);
}
else {
s = c[3];
c.erase(c.begin() + 3);
}
}
while(coins != N-1){
int curr = press(s+c[0]+s+c[1]+c[0]+s+c[1]+c[1]+s+c[1]+c[2]);
if(curr == coins+1) {
s += c[0];
} else if(curr == coins+2) {
s += c[1];
} else{
s += c[2];
}
coins++;
}
if(press(s + c[0]) > coins){
s += c[0];
} else if(press(s + c[1]) > coins) {
s += c[1];
} else {
s += c[2];
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |