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;
/*std::string guess_sequence(int N) {
std::string p = "";
for (int i = 0; i < 4 * N; ++i) {
p += 'A';
}
int coins = press(p);
std::string S = "";
for (int i = 0; i < N; ++i) {
S += 'A';
}
return S;
}*/
string guess_sequence(int N) {
string p="";
int n=press("AB");
char first;
if (n>=1) {
int m=press("A");
if (m==1) {
first='A';
}
else {
first='B';
}
}
else {
int m=press("X");
if (m==1) {
first='X';
}
else {
first='Y';
}
}
string cur(1,first);
set<string> others={"A", "B","X","Y"};
vector<string> v;
others.erase(cur);
for (auto i:others) {
v.push_back(i);
}
for (int i=1; i<=N; i++) {
string guesseq="";
for (int j=0; j<3; j++) {
guesseq+=cur+v[0]+v[j];
}
guesseq+=cur+v[1];
int ans=press(guesseq);
if (ans==i) {
cur+=v[2];
}
else if (ans==i+1) {
cur+=v[1];
}
else {
assert(ans==i+2);
cur+=v[0];
}
}
return cur;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |