Submission #1015098

#TimeUsernameProblemLanguageResultExecution timeMemory
1015098KindaNamelessCombo (IOI18_combo)C++14
100 / 100
28 ms1796 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N){ string answer = ""; if(press("AB")){ if(press("A")){ answer += "A"; } else{ answer += "B"; } } else{ if(press("X")){ answer += "X"; } else{ answer += "Y"; } } if(N == 1){ return answer; } vector<char> cand; if(answer[0] != 'A')cand.push_back('A'); if(answer[0] != 'B')cand.push_back('B'); if(answer[0] != 'X')cand.push_back('X'); if(answer[0] != 'Y')cand.push_back('Y'); string g; for(int i = 1; i <= N - 2; ++i){ g = answer + cand[0] + cand[0] + answer + cand[0] + cand[1] + answer + cand[0] + cand[2] + answer + cand[1]; int val = press(g); if(val == (int)answer.size() + 2){ answer += cand[0]; } else if(val == (int)answer.size() + 1){ answer += cand[1]; } else{ answer += cand[2]; } } g = answer + cand[0] + answer + cand[1]; if(press(g) == N){ g = answer + cand[0]; if(press(g) == N){ answer += cand[0]; } else{ answer += cand[1]; } } else{ answer += cand[2]; } return answer; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...