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;
namespace SUB1 {
string guess_sequence(int N) {
string ans = "";
for (int i = 0; i < N; i++) {
for (char c : {'A', 'B', 'X', 'Y'}) {
ans.push_back(c);
if (press(ans) == i + 1)
break;
ans.pop_back();
}
}
return ans;
}
}
namespace SUB2 {
string chars = "ABXY";
string guess_sequence(int N) {
string ans = "";
for (int i = 0; i < N; i++) {
int cnt = 0;
for (auto it = chars.begin(); it != chars.end(); it++) {
char c = *it;
if (not ans.empty() and c == ans.front())
continue;
cnt++;
ans.push_back(c);
if (i == 0 and cnt == 4)
break;
if (i > 0 and cnt == 3)
break;
if (press(ans) == i + 1)
break;
ans.pop_back();
}
}
return ans;
}
}
string guess_sequence(int N) {
if (N == 3)
return SUB1::guess_sequence(N);
return SUB2::guess_sequence(N);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |