Submission #713111

#TimeUsernameProblemLanguageResultExecution timeMemory
713111hoainiemCombo (IOI18_combo)C++14
100 / 100
32 ms612 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string vt, st; pair<int, int>ds[3]{{0, 1}, {0, 2}, {1, 2}}; string s[3]; int k, mask; std::string guess_sequence(int n) { string ans; k = press("AB"); if (k == 2) ans = "AB"; else{ if (k == 1){ if (press("A")) ans = "A"; else ans = "B"; } else{ if (press("X")) ans = "X"; else ans = "Y"; } } // if (n == 1) // return ans; vt = {'A', 'B', 'X', 'Y'}; for (int i = 0; i < 4; i++) if (vt[i] == ans[0]){ vt.erase(vt.begin() + i); break; } mask = vt[0] ^ vt[1] ^ vt[2]; char a = vt[0], b = vt[1], c = vt[2]; while ((int)ans.size() < n){ int sz = ans.size(); if (n - (int)ans.size() == 1){ if (press(ans + a) == n) return ans + a; else{ if(press(ans + b) == n) return ans + b; return ans + c; } } int op = press(ans + a + ans + b + a + ans + b + b + ans + b + c); if (op == sz) ans = ans + c; else{ if (op - sz == 1) ans = ans + a; else ans = ans + b; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...