Submission #1142645

#TimeUsernameProblemLanguageResultExecution timeMemory
1142645rayankadCombo (IOI18_combo)C++20
100 / 100
7 ms468 KiB
#include "combo.h" using namespace std; string guess_sequence(int N) { if(N == 0){ return ""; } string p = "AB"; int coins = press(p); string P; string buttons = "BXY"; if(coins >0){ coins = press("A"); if(coins == 1){ P = "A"; } else{ buttons = "AXY"; P = "B"; } } else{ coins = press("X"); if(coins == 1){ buttons = "ABY"; P = "X"; } else{ buttons = "ABX"; P = "Y"; } } while(P.size() < N-1){ int q = press(P+buttons[0] + P+buttons[1]+buttons[1] + P+buttons[1]+buttons[2] + P+buttons[1]+buttons[0]); if(q == P.size()){ P+=buttons[2]; } else if(q == P.size()+1){ P+=buttons[0]; } else{ P+=buttons[1]; } } if(N <= 1){ return P; } int q = press(P+buttons[0]+P+buttons[1]); if(q >= P.size()+1){ q = press(P+buttons[0]); if(q >= P.size()+1){ return P+buttons[0]; } return P+buttons[1]; } else return P+buttons[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...