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;
using ll = long long;
char find_the_first_character(){
if(press("A")==1) return 'A';
if(press("B")==1) return 'B';
if(press("X")==1) return 'X';
return 'Y';
}
string guess_sequence(int n) {
char f=find_the_first_character();
string just="ABXY", abxy="";
string s="";
s+=f;
for(auto c: just){
if(c==f) continue;
abxy+=c;
}
int i=2;
while(i<=n){
string s1="";
if(i+1<=n){
s1+=s+abxy[0];
s1+=s+abxy[1]+abxy[0];
s1+=s+abxy[1]+abxy[1];
s1+=s+abxy[1]+abxy[2];
int coins=press(s1);
if(coins==i) s+=abxy[0];
else if(coins==i+1) s+=abxy[1];
else s+=abxy[2];
}
else{
if(press(s+abxy[0])==i){
s+=abxy[0];
}
else if(press(s+abxy[1])==i){
s+=abxy[1];
}
else{
s+=abxy[2];
}
}
i++;
}
// cout << s << '\n';
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |