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 S = "";
char a;
string p = "AB";
int coins = press(p);
if(coins){
p = "A";
coins = press(p);
if(coins) a = 'A';
else a = 'B';
}
else{
p = "X";
coins = press(p);
if(coins) a = 'X';
else a = 'Y';
}
S += a;
if(N == 1) return S;
vector <char> v;
if(a != 'A') v.push_back('A');
if(a != 'B') v.push_back('B');
if(a != 'X') v.push_back('X');
if(a != 'Y') v.push_back('Y');
for(int i = 2; i <= N-1; i++){
p = "";
for(auto x : v) p += S + v[0] + x;
p += S + v[1];
coins = press(p);
if(coins == i+1) S += v[0];
else if(coins == i) S += v[1];
else S += v[2];
}
p = S + v[0] + S + v[1];
coins = press(p);
if(coins == N){
p = S + v[0];
coins = press(p);
if(coins == N) S += v[0];
else S += v[1];
}
else S += v[2];
return S;
}
// int main(){
// ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// }
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |