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;
char ban = 'X';
string C;
vector<char> canuse;
char next(int p) {
p--;
string req = "";
req += C + canuse[0] + canuse[0];
req += C + canuse[0] + canuse[1];
req += C + canuse[0] + canuse[2];
req += C + canuse[1] + ban;
int coins = press(req);
if(coins == p)
return canuse[2];
if(coins == p+1)
return canuse[1];
return canuse[0];
}
std::string guess_sequence(int N) {
char a[] = {'A', 'B', 'Y', 'X'};
for(int i = 0; i < 3; i++)
if(press(string(1, a[i]))) {
ban = a[i];
break;
}
for(int i = 0; i < 4; i++)
if(a[i] != ban)
canuse.push_back(a[i]);
C = ban;
for(int i = 2; i < N; i++)
C += next(i);
if(N > 1) {
if(press(C+canuse[0]) == N)
C += canuse[0];
else if(press(C+canuse[1]) == N)
C += canuse[1];
else
C += canuse[2];
}
return C;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |