Submission #815210

#TimeUsernameProblemLanguageResultExecution timeMemory
815210errayCombo (IOI18_combo)C++17
100 / 100
43 ms644 KiB
#include "combo.h" //author: erray #include <bits/stdc++.h> using namespace std; #ifdef DEBUG #include "/home/ioi/codes/debug.h" #else #define debug(...) (void) 37 #endif string M = "ABXY"; std::string guess_sequence(int N) { int p = 2 * (press(string(2 * N, M[0]) + string(2 * N, M[1])) == 0); p += press(string(4 * N, M[p + 1])); char first = M[p]; string ans = ""s + M[p]; M.erase(find(M.begin(), M.end(), M[p])); for (int i = 1; i < N - 1; ++i) { string ask; ask += ans + M[1]; for (int c = 0; c < 3; ++c) { ask += ans + M[2] + M[c]; } ask += string(4 * N - int(ask.size()), first); ans += M[press(ask) - i]; } if (N > 1) { char last = M[2]; for (int i = 0; i < 2; ++i) { string ask = ans + M[i]; if (press(ask + ask + ask + ask) == N) { last = M[i]; } } ans += last; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...