Submission #1165208

#TimeUsernameProblemLanguageResultExecution timeMemory
1165208kunzaZa183Combo (IOI18_combo)C++20
100 / 100
8 ms636 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string res; int num = press("AB"); if (num > 0) { num = press("A"); if (num > 0) res = "A"; else res = "B"; } else { num = press("X"); if (num > 0) res = "X"; else res = "Y"; } if (N == 1) return res; string choice = "ABXY"; choice.erase(find(choice.begin(), choice.end(), res[0])); for (int i = 1; i < N - 1; i++) { vector<string> vs(4, res); vs[0].push_back(choice[0]); vs[1].push_back(choice[1]); vs[1].push_back(choice[0]); vs[2].push_back(choice[1]); vs[2].push_back(choice[1]); vs[3].push_back(choice[1]); vs[3].push_back(choice[2]); string sth = vs[0] + vs[1] + vs[2] + vs[3]; num = press(sth); if (num == i + 1) { res.push_back(choice[0]); } else if (num == i + 2) { res.push_back(choice[1]); } else { res.push_back(choice[2]); } } res.push_back(choice[0]); num = press(res); if (num == N) { return res; } res.pop_back(); res.push_back(choice[1]); num = press(res); if (num == N) { return res; } res.pop_back(); res.push_back(choice[2]); return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...