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>
#define pb push_back
using namespace std;
std::string guess_sequence(int N) {
std::string p = "";
if(press("AB") >= 1) {
if(press("A") == 1) p += "A";
else p += "B";
}
else {
if(press("X") == 1) p += "X";
else p += "Y";
}
vector<char> letters;
if(p[0] != 'A') letters.pb('A');
if(p[0] != 'B') letters.pb('B');
if(p[0] != 'X') letters.pb('X');
if(p[0] != 'Y') letters.pb('Y');
for(int i=2;i<=N;i++) {
if(i < N) {
string temp = p + letters[0] + letters[0];
string temp2 = p + letters[0] + letters[1];
string temp3 = p + letters[0] + letters[2];
string temp4 = p + letters[1];
string t = temp + temp2 + temp3 + temp4;
int x = press(t);
if(x == i) p += letters[1];
else if(x > i) p += letters[0];
else p += letters[2];
}
else {
if(press(p + letters[0]) == N) p += letters[0];
else if(press(p + letters[1]) == N) p += letters[1];
else p += letters[2];
}
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |