Submission #237418

#TimeUsernameProblemLanguageResultExecution timeMemory
237418dannber_BRCombo (IOI18_combo)C++14
10 / 100
68 ms548 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string Btns[] = {"A","B","X","Y"}; string guess_sequence(int N) { string s = ""; int p = 0; int long_gues = 0; if (press(Btns[0]) == 1) { s += Btns[0]; p = 0; long_gues++; } else if (press(Btns[1]) == 1) { s += Btns[1]; p = 1; long_gues++; } else if (press(Btns[2]) == 1){ s += Btns[2]; p = 2; long_gues++; } else if (press(Btns[3]) == 1) { s += Btns[3]; p = 3; long_gues++; } if (N == 1) { return s; } if (press(s + Btns[0]) == 2) { s += Btns[0]; long_gues++; } else if (press(s+Btns[1]) == 2) { s += Btns[1]; long_gues++; } else if (press(s+Btns[2]) == 2){ s += Btns[2]; long_gues++; } else if (press(s+Btns[3]) == 2) { s += Btns[3]; long_gues++; } if (N == 2) return s; if (press(s + Btns[0]) == 3) { s += Btns[0]; long_gues++; } else if (press(s+Btns[1]) == 3) { s += Btns[1]; long_gues++; } else if (press(s+Btns[2]) == 3){ s += Btns[2]; long_gues++; } else if (press(s+Btns[3]) == 3) { s += Btns[3]; long_gues++; } if (N == 3) return s; int last_one = 0; for(int i = long_gues + 1;i <= N;) { bool fact = false; if (press(s + Btns[last_one]) == i) { s += Btns[last_one]; fact = true; long_gues++; i++; } else if (fact == false) { for(int j = 0;j <= 3;j++) { if(j != p && !fact) { if (press(s + Btns[j]) == i) { s += Btns[j]; fact = true; last_one = j; i++; } } } } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...