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>
using namespace std;
string guess_sequence(int N) {
set<char> X = {'A', 'B', 'X', 'Y'};
string s = "";
for (auto it = X.begin(); it != X.end(); it++) {
int x = press(s + *it);
if (x != 0) {
s += *it;
X.erase(it);
break;
}
}
if (s == "") {
return s;
}
int prev = 1;
bool ok = true;
while (ok) {
ok = false;
int sz = (int) s.size(), c = 0;
if (sz == N) {
break;
}
for (auto it = X.begin(); it != X.end(); it++, c++) {
if (c == 2) {
s += *it;
ok = true;
prev++;
}
string poss = s + *it;
int x = press(poss);
if (x > prev) {
s = poss;
ok = true;
prev = x;
break;
}
}
}
return s;
}
Compilation message (stderr)
combo.cpp:1:19: warning: extra tokens at end of #include directive
1 | #include "combo.h";
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |