Submission #1142380

#TimeUsernameProblemLanguageResultExecution timeMemory
1142380orzdraiduwuCombo (IOI18_combo)C++20
100 / 100
7 ms484 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string g = ""; int a = press("AB"); vector<char> uw = {'A', 'B', 'X', 'Y'}; if(a == 0) { int b = press("X"); if(b) g = "X"; else g = "Y"; } else { int b = press("A"); if(b) g = "A"; else g = "B"; } if(n == 1) return g; vector<int> nw; for(char c: uw) if(c != g[0]) nw.push_back(c); char a1 = nw[0], a2 = nw[1], a3 = nw[2]; for(int i = 1 ; i < n-1 ; i++) { // string a1 = nw[0], a2 = nw[1], a3 = nw[2]; string p = g + a1 + g + a2 + a1 + g + a2 + a2 + g + a2 + a3; int va = press(p); va = va - i; if(va == 0) g.push_back(a3); else if(va == 1) g.push_back(a1); else g.push_back(a2); // cout << va << " " << g << endl; } int o = press(g + a1 + g + a2); // cout << o << endl; if(o == n) { int k = press(g + a1); // cout << k << endl; if(k == n) g.push_back(a1); else g.push_back(a2); } else { g.push_back(a3); } return g; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...