Submission #629857

#TimeUsernameProblemLanguageResultExecution timeMemory
629857airthsCombo (IOI18_combo)C++17
100 / 100
31 ms540 KiB
#include "combo.h" std::string guess_sequence(int N) { std::string p = ""; std::string c=""; if (press("AB")>0){ if (press("A")>0){ c="BXY"; p="A"; } else { c="AXY"; p="B"; } } else { if (press("X")>0){ c="ABY"; p="X"; } else { c="ABX"; p="Y"; } } if (N==1)return p; for (int i=1; i<N-1; i++){ int coins=press(p+c[0]+c[0]+p+c[0]+c[1]+p+c[0]+c[2]+p+c[1]); if (coins==i+1){ p+=c[1]; } else if (coins==i+2){ p+=c[0]; } else { p+=c[2]; } } if (press(p+c[0])==N){ p+=c[0]; } else if (press(p+c[1])==N){ p+=c[1]; } else { p+=c[2]; } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...