Submission #1142620

#TimeUsernameProblemLanguageResultExecution timeMemory
1142620rayankadCombo (IOI18_combo)C++20
94 / 100
6 ms468 KiB
#include "combo.h" using namespace std; string guess_sequence(int N) { 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]; } } for(int i = 0; i < 3; i++){ int q = press(P+buttons[i]); if(q == P.size()+1){ return P+buttons[i]; } } return P; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...