Submission #1043135

#TimeUsernameProblemLanguageResultExecution timeMemory
1043135thatsgonzalezCombo (IOI18_combo)C++14
100 / 100
19 ms1256 KiB
#include "combo.h" #include "bits/stdc++.h" using namespace std; std::string guess_sequence(int N) { std::string p = ""; int k = 0; int res = press("AB"); if(res){ res = press("A"); if(res) p+="A"; else p+="B"; } else{ res = press("X"); if(res) p+="X"; else p+="Y"; } k++; vector<string> aux; string query; if(p != "A") aux.push_back("A"); if(p != "B") aux.push_back("B"); if(p != "X") aux.push_back("X"); if(p != "Y") aux.push_back("Y"); for(int i = 1; i<N-1; i++){ query = p+aux[0]+p+(aux[1]+aux[0])+p+(aux[1]+aux[1])+p+(aux[1]+aux[2]); res = press(query); if(res-k == 2){ p+=aux[1]; } else if(res-k == 1){ p+=aux[0]; } else{ p+=aux[2]; } k++; } if(N>1){ query = p + aux[0]; res = press(query); if(res-k>0) p += aux[0]; else{ query = p + aux[1]; res = press(query); if(res-k) p+=aux[1]; else p+=aux[2]; } } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...