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>
typedef long long ll;
typedef unsigned long long ull;
#define F first
#define S second
#define pb push_back
#include "combo.h"
using namespace std;
constexpr int debug = 0;
string guess_sequence(int n){
vector<char> usable;
string curr = "";
int a1 = press("AB");
if(a1){
a1 = press("AXAY");
(a1 >= 1) ? curr = "A" : curr = "B";
}
else{
a1 = press("XAXB");
(a1 >= 1) ? curr = "X" : curr = "Y";
}
vector<char> all = {'A', 'B', 'X', 'Y'};
for(auto k: all){
if(k != curr[0]) usable.pb(k);
}
string tochek = "";
for(int i = 2; i < n; i++){ //iteracja po dlugosci
tochek = curr + usable[0];
for(int j = 0; j < 3; j++) tochek += (curr + usable[1] + usable[j]);
a1 = press(tochek);
if(a1-curr.size() == 2) curr += usable[1];
else if(a1-curr.size()) curr += usable[0];
else curr += usable[2];
}
if(n >= 2){
tochek = curr + usable[0] + curr + usable[1];
a1 = press(tochek)-curr.size();
tochek = curr + usable[1] + curr + usable[2];
int a2 = press(tochek)-curr.size();
if(a1 && a2) curr += usable[1];
else if(a1) curr += usable[0];
else curr += usable[2];
}
return curr;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |