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 <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
string guess_sequence(int N) {
vector<char> ch;
char c1, c2, c3;
string cur = "A";
if (press(cur)) {
c1 = 'B';
c2 = 'X';
c3 = 'Y';
}
else {
cur = "B";
if (press(cur)) {
c1 = 'A';
c2 = 'X';
c3 = 'Y';
}
else {
cur = "X";
if (press(cur)) {
c1 = 'A';
c2 = 'B';
c3 = 'Y';
}
else {
cur = "Y";
c1 = 'A';
c2 = 'B';
c3 = 'X';
}
}
}
string s1=cur, s2=cur;
for (int i = 2; i <= N; i++) {
s1 = cur, s2 = cur;
s1.push_back(c1);
s2.push_back(c2);
cur = s1 + s2;
if (press(cur) == i) {
if (press(s1) == i)
cur = s1;
else
cur = s2;
}
else {
s1.pop_back();
cur = s1;
cur.push_back(c3);
}
}
return cur;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |