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"
#define pb push_back
#define ppb pop_back
using namespace std;
string guess_sequence(int n){
string ans = "", temp = "ABXY";
char ex = 'S';
int cnt = 1;
if(press("AB")){
if(press("A")) ex = 'A';
else ex = 'B';
}
else if(press("X")) ex = 'X';
else ex = 'Y';
ans.pb(ex);
string newtemp = "";
for(auto& x : temp) if(x != ex) newtemp.pb(x);
while(cnt < n - 1){
string uhh = ans;
uhh.pb(newtemp[0]);
uhh += ans;
uhh.pb(newtemp[1]);
uhh.pb(newtemp[0]);
uhh += ans;
uhh.pb(newtemp[1]);
uhh.pb(newtemp[1]);
uhh += ans;
uhh.pb(newtemp[1]);
uhh.pb(newtemp[2]);
int val = press(uhh);
if(val == cnt) ans.pb(newtemp[2]);
if(val == cnt + 2) ans.pb(newtemp[1]);
if(val == cnt + 1) ans.pb(newtemp[0]);
cnt ++;
}
if(cnt == n) return ans;
string uhh = ans;
uhh.pb(newtemp[0]);
uhh += ans;
uhh.pb(newtemp[1]);
if(press(uhh) - cnt >= 1){
uhh = ans;
uhh.pb(newtemp[0]);
if(press(uhh) - cnt == 1) ans.pb(newtemp[0]);
else ans.pb(newtemp[1]);
}
else ans.pb(newtemp[2]);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |