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 <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include <iterator>
#include <set>
#include <map>
#include <math.h>
#include <iomanip>
#include <unordered_set>
#include "combo.h"
using namespace std;
string guess_sequence(int n) {
vector<string> moves = {"A", "B", "X", "Y"};
string s = "";
for (int i = 0; i < 3; i++){
string guess = moves[i];
if (press(guess) == 1){
s += moves[i];
auto it = find(moves.begin(), moves.end(), guess);
moves.erase(it);
break;
}
}
while (int(s.size()) < n - 1){
string guess = s + moves[0] + s + moves[1] + moves[0] + s + moves[1] + moves[1] + s + moves[1] + moves[2];
int coins = press(guess);
if (coins == int(s.size())) s += moves[2];
else if (coins == int(s.size()) + 1) s += moves[0];
else if (coins == int(s.size()) + 2) s += moves[1];
}
for (int i = 0; i < 3; i++){
string guess = s + moves[i];
if (press(guess) == int(s.size()) + 1){
s += moves[i];
break;
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |