Submission #1093697

#TimeUsernameProblemLanguageResultExecution timeMemory
1093697belgianbotCombo (IOI18_combo)C++17
100 / 100
23 ms1096 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { vector<char> poss; string p = "AB"; int act = press(p); if (act) { p = "A"; if (press(p)) { poss = {'B', 'X', 'Y'}; } else { p = "B"; poss = {'A', 'X', 'Y'}; } } else { p = "X"; if (press(p)) { poss = {'A', 'B', 'Y'}; } else { p = "Y"; poss = {'A', 'B', 'X'}; } } for (int i = 1; i < N; i++) { string test = p; if (i != N - 1) { test += poss[0]; test += p; test += poss[1]; test += poss[0]; test += p; test += poss[1]; test += poss[1]; test += p; test += poss[1]; test += poss[2]; int coins = press(test); if (coins == i + 1) p += poss[0]; else if (coins == i + 2) p += poss[1]; else p += poss[2]; } else { test += poss[0]; int res = press(test); if (res == N) p += poss[0]; else { test = p; test += poss[1]; res = press(test); if (res == N) p += poss[1]; else p += poss[2]; } } } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...