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;
}
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int i=2;
while(i<=n){
for(auto c: abxy){
string s1=s+c;
char c1=abxy[rng()%3];
char c2=abxy[rng()%3];
char c3=abxy[rng()%3];
if(i+1<=n){
s1+=s+c+c1;
}
if(i+2<=n){
s1+=s+c+c1+c2;
}
if(i+3<=n){
s1+=s+c+c1+c2+c3;
}
int coins=press(s1);
if(coins==i-1) continue;
if(coins>=i) s+=c;
if(coins>=i+1) s+=c1;
if(coins>=i+2) s+=c2;
if(coins>=i+3) s+=c3;
i=coins+1;
break;
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |