Submission #402278

#TimeUsernameProblemLanguageResultExecution timeMemory
402278radaiosm7Combo (IOI18_combo)C++17
100 / 100
41 ms576 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string avail[3]; int val, i; string guess_sequence(int n) { string p = ""; if (press("AB") > 0) { if (press("A") == 1) { avail[0] = "B"; avail[1] = "X"; avail[2] = "Y"; p = "A"; } else { avail[0] = "A"; avail[1] = "X"; avail[2] = "Y"; p = "B"; } } else if (press("X") == 1) { avail[0] = "B"; avail[1] = "A"; avail[2] = "Y"; p = "X"; } else { avail[0] = "B"; avail[1] = "X"; avail[2] = "A"; p = "Y"; } if (n == 1) { return p; } for (i=2; i < n; ++i) { val = press(p+avail[0]+p+avail[1]+avail[0]+p+avail[1]+avail[1]+p+avail[1]+avail[2]); if (val == i-1) { p += avail[2]; } else if (val == i) { p += avail[0]; } else { p += avail[1]; } } if (press(p+avail[0]) == n) return p+avail[0]; else if (press(p+avail[1]) == n) return p+avail[1]; else return p+avail[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...