Submission #1142536

#TimeUsernameProblemLanguageResultExecution timeMemory
1142536draiiiiiiiiiiidCombo (IOI18_combo)C++20
0 / 100
0 ms408 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string g = ""; int k = press("AB"); if(k) { k = press("A"); if(k) g = "A"; else g = "B"; } else { k = press("X"); if(k) g = "X"; else g = "Y"; } if(n == 1) return g; vector<char> dd = {'A', 'B', 'X', 'Y'}, nw; for(char i: dd) if(i != g[0]) nw.push_back(i); for(int i = 1 ; i < n-1 ; i++) { string p = g + nw[0] + g + nw[1] + nw[0] + g + nw[1] + nw[1] + g + nw[1] + nw[2]; // cout << p << endl; int m = press(p); m -= i; if(m == 0) g.push_back(nw[2]); else if(m == 1) g.push_back(nw[0]); else g.push_back(nw[1]); } k = press(g + nw[0] + g + nw[1]); if(!k) g.push_back(nw[2]); else { k = press(g + nw[0]); if(k) g.push_back(nw[0]); else g.push_back(nw[1]); } return g; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...