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 <bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
string ans = "";
string poss = "ABXY";
for (int i = 0; i < 4; i++) {
string temp = "" + poss[i];
int cnt = press(temp);
if (cnt > 0) {
poss.erase(poss.begin() + i);
ans += temp;
break;
}
}
if(N == 1) {
return ans;
}
bool ok = true;
int prev = 1;
while (ok && (int) ans.size() < N) {
ok = false;
for (int i = 0; i < 3; i++) {
string newAns = ans + "" + poss[i];
int cnt = press(newAns);
if(cnt > prev) {
ans = newAns;
ok = true;
prev = cnt;
break;
}
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |