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 <climits>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <vector>
#include "combo.h"
using namespace std;
using ll = long long;
//int press(string s) {
// return 0;
//}
string guess_sequence(int N) {
string cur;
char letters[] {'A', 'B', 'X', 'Y'};
// find first letter
char first;
if (press(cur + letters[0]) == 1) {
first = letters[0];
} else if (press(cur + letters[1]) == 1) {
first = letters[1];
} else if (press(cur + letters[2]) == 1) {
first = letters[2];
} else {
first = letters[3];
}
cur += first;
// array without first
char n_letters[3]; int nxt = 0;
for (char c : letters) {
if (c != first)
n_letters[nxt++] = c;
}
// find next letters
for (int i = 1; i < N; i++) {
int p_len = press(cur + n_letters[0] + n_letters[0]
+ cur + n_letters[0] + n_letters[1]
+ cur + n_letters[0] + n_letters[2]
+ cur + n_letters[1]);
if (p_len == i)
cur += n_letters[2];
else if (p_len == i + 1)
cur += n_letters[1];
else
cur += n_letters[0];
}
return cur;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |