Submission #75118

#TimeUsernameProblemLanguageResultExecution timeMemory
75118imeimi2000Combo (IOI18_combo)C++17
100 / 100
52 ms612 KiB
#include "combo.h" using namespace std; string guess_sequence(int n) { char cs[] = "ABXY"; if (press("AB")) { if (press("A")) swap(cs[3], cs[0]); else swap(cs[3], cs[1]); } else if (press("X")) swap(cs[3], cs[2]); string ret = ""; ret += cs[3]; if (n == 1) return ret; for (int i = 1; i < n - 1; ++i) { string Q = ""; Q += ret; Q += cs[1]; Q += ret; Q += cs[2]; Q += cs[0]; Q += ret; Q += cs[2]; Q += cs[1]; Q += ret; Q += cs[2]; Q += cs[2]; int R = press(Q); ret += cs[R - i]; } if (press(ret + cs[0]) == n) return ret + cs[0]; if (press(ret + cs[1]) == n) return ret + cs[1]; return ret + cs[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...