제출 #1049282

#제출 시각아이디문제언어결과실행 시간메모리
1049282MrDogMeat콤보 (IOI18_combo)C++17
100 / 100
28 ms1908 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N) { string res = ""; vector<char> vec = {'A', 'B', 'X', 'Y'}; if(press("AB") >= 1) { if(press("A") == 1) { res += 'A'; vec.erase(vec.begin()); } else { res += 'B'; vec.erase(vec.begin() + 1); } } else { if(press("X") == 1) { res += 'X'; vec.erase(vec.begin() + 2); } else { res += 'Y'; vec.erase(vec.begin() + 3); } } if(N == 1) return res; for(int i = 2; i < N; i++) { string Try = res + vec[0] + res + vec[1] + vec[0] + res + vec[1] + vec[1] + res + vec[1] + vec[2]; int coins = press(Try); if(coins == i) res += vec[0]; else if(coins == i + 1) res += vec[1]; else res += vec[2]; } if(press(res + vec[0]) == N) res += vec[0]; else if(press(res + vec[1]) == N) res += vec[1]; else res += vec[2]; return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...