Submission #600632

#TimeUsernameProblemLanguageResultExecution timeMemory
600632piOOECombo (IOI18_combo)C++17
100 / 100
36 ms684 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string s; if (press("AB")) { if (press("A")) { s = "A"; } else { s = "B"; } } else { if (press("X")) { s = "X"; } else { s = "Y"; } } if (n == 1) { return s; } string L; if (s == "A") { L = "BXY"; } else if (s == "B") { L = "AXY"; } else if (s == "X") { L = "ABY"; } else { L = "ABX"; } for (int i = 1; i < n - 1; ++i) { string str[3] = {s + L[0], s + L[1], s + L[2]}; int val = press(str[0] + L[0] + str[0] + L[1] + str[0] + L[2] + str[1]); if (val == i + 2) { s += L[0]; } else if (val == i + 1) { s += L[1]; } else { s += L[2]; } } if (press(s + L[0]) == n) { return s + L[0]; } else if (press(s + L[1]) == n) { return s + L[1]; } else { return s + L[2]; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...