제출 #713113

#제출 시각아이디문제언어결과실행 시간메모리
713113tht2005콤보 (IOI18_combo)C++17
0 / 100
1 ms208 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string BUTTONS = "ABXY"; int first_button = (press("AB") == 1) ? ((press("A") == 1) ? 0 : 1) : ((press("X") == 1) ? 2 : 3); swap(BUTTONS[3], BUTTONS[first_button]); string res(1, BUTTONS[3]); for(int i = 2; i < N; ++i) { string ask = res; ask.push_back(BUTTONS[0]); for(int j = 0; j < 3; ++j) { for(char ch : res) { ask.push_back(ch); } ask.push_back(BUTTONS[1]); ask.push_back(BUTTONS[j]); } int o = press(ask); if(o == i) { res.push_back(BUTTONS[0]); } else if(o == i + 1) { res.push_back(BUTTONS[1]); } else { res.push_back(BUTTONS[2]); } } if(N > 1) { int last = 0; for(int ch = 1; ch < 3; ++ch) { string ask = res; ask.push_back(BUTTONS[ch]); if(press(ask) == N) { last = ch; break; } } res.push_back(BUTTONS[last]); } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...