# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
701039 | BobCompetitiveProgramming | Combo (IOI18_combo) | C++14 | 46 ms | 472 KiB |
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>
using namespace std; using ll=long long;
int press(std::string p);
string getRandom(string start, string no, int sz){
while(start.size() < sz){
int r = rand() % 4 + 1;
if(r==1 && "A" != no) start += "A";
if(r==2 && "B" != no) start += "B";
if(r==3 && "X" != no) start += "X";
if(r==4 && "Y" != no) start += "Y";
}
return start;
}
string guess_sequence(int N){
string S = "", first;
if(press("AB")) {
if(press("A")) first="A", S="A";
else first="B", S="B";
} else {
if(press("X")) first="X", S="X";
else first="Y", S="Y";
}
while(true){
int curr_size = S.size();
if(curr_size == N)
return S;
if(first=="X"){
if(press(S+"A"+S+"B")>curr_size){
if(press(S+"A")>curr_size) S+="A";
else S+="B";
} else
S+="Y";
}
if(first=="Y"){
if(press(S+"A"+S+"B")>curr_size){
if(press(S+"A")>curr_size) S+="A";
else S+="B";
} else
S+="X";
}
if(first=="A"){
if(press(S+"B"+S+"X")>curr_size){
if(press(S+"B")>curr_size) S+="B";
else S+="X";
} else
S+="Y";
}
if(first=="B"){
if(press(S+"A"+S+"X")>curr_size){
if(press(S+"A")>curr_size) S+="A";
else S+="X";
} else
S+="Y";
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |