Submission #376329

#TimeUsernameProblemLanguageResultExecution timeMemory
376329benedict0724Combo (IOI18_combo)C++17
100 / 100
57 ms496 KiB
#include "combo.h" using namespace std; std::string guess_sequence(int N) { std::string p = "AB", S = "", P = ""; string f, s, t; int coins = press(p); if(coins){ p = "A"; coins = press(p); if(coins) { S = "A", f = "B", s = "X", t = "Y"; } else { f = "A", S = "B", s = "X", t = "Y"; } } else{ p = "X"; coins = press(p); if(coins) { f = "A", s = "B", S = "X", t = "Y"; } else { f = "A", s = "B", t = "X", S = "Y"; } } int i; for (i = 1; i < N - 1; ++i) { P = ""; P = S + f + f + S + s + f + S + s + s; coins = press(P); if(coins == i) { S += t; continue; } else if(coins == i+1){ P = S + f + s; coins = press(P); if(coins == i) S += s + t; else if(coins == i+1) S += f + t; else S += f + s; } else{ P = S + s + f; coins = press(P); if(coins == i) S += f + f; else if(coins == i+1) S += s + s; else S += s + f; } ++i; } if(i == N - 1){ P = S + f; coins = press(P); if(coins == N) S += f; else{ P = S + s; coins = press(P); if(coins == N) S += s; else S += t; } } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...