# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
528646 | rayfish | Combo (IOI18_combo) | C++17 | 48 ms | 668 KiB |
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
for (int t_i = 0; t_i < 3; t_i++) {
if (press(cur + letters[t_i]) == 1) {
cur += letters[t_i];
break;
}
}
if (cur.length() == 0) {
cur += letters[3];
}
// find next letters
for (int i = 1; i < N; i++) {
int num_c = 0;
int t_i = 0;
for (; num_c < 2; t_i++) {
if (cur[0] == letters[t_i])
continue;
if (press(cur + letters[t_i]) == i+1) {
cur += letters[t_i];
break;
} else {
num_c++;
}
}
if (cur.length() == i) {
if (t_i == 3) {
cur += letters[3];
} else {
cur += (cur[0] == letters[2] ? letters[3] : letters[2]);
}
}
}
return cur;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |