Submission #376322

#TimeUsernameProblemLanguageResultExecution timeMemory
376322benedict0724Combo (IOI18_combo)C++17
0 / 100
23 ms508 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 += s + t; else if(coins == i+1) S += s + s; else S += f + 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...