Submission #516240

#TimeUsernameProblemLanguageResultExecution timeMemory
516240JomnoiCombo (IOI18_combo)C++17
100 / 100
31 ms584 KiB
#include <bits/stdc++.h> #include "combo.h" #define DEBUG 0 using namespace std; string guess_sequence(int N) { // Play with the lucky! string res, s; // Find the first letter of string S if(press("AB") >= 1) { if(press("A") == 1) { res = 'A'; s = "BXY"; } else { res = 'B'; s = "AXY"; } } else { if(press("X") == 1) { res = 'X'; s = "ABY"; } else { res = 'Y'; s = "ABX"; } } // For N = 1 if(N == 1) { return res; } // Solve other letter for(int i = 1; i < N - 1; i++) { int coins = press(res + s[0] + res + s[1] + s[0] + res + s[1] + s[1] + res + s[1] + s[2]); if(coins == i + 1) { res += s[0]; } else if(coins == i + 2) { res += s[1]; } else { res += s[2]; } } if(press(res + s[0] + res + s[1]) == N) { if(press(res + s[0]) == N) { res += s[0]; } else { res += s[1]; } } else { res += s[2]; } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...