제출 #338228

#제출 시각아이디문제언어결과실행 시간메모리
338228markussie콤보 (IOI18_combo)C++17
100 / 100
42 ms540 KiB
#include "combo.h" #include <vector> #include <algorithm> std::string guess_sequence(int N) { using std::string; using std::vector; string res; if(press("AB")) if(press("A")) res = "A"; else res = "B"; else if(press("X")) res = "X"; else res = "Y"; vector<char> avail{'A', 'B', 'X', 'Y'}; avail.erase(std::find(avail.begin(), avail.end(), res[0])); for(int i = 1; i < N-1; ++i) { int type = press(res + avail[0] + res + avail[1] + avail[0] + res + avail[1] + avail[1] + res + avail[1] + avail[2]) - res.size(); if(type == 0) res += avail[2]; else if(type == 1) res += avail[0]; else res += avail[1]; } if(N - 1) { int type = press(res + avail[0]) - res.size(); if(type == 0) if(press(res + avail[1]) - res.size()) res += avail[1]; else res += avail[2]; else res += avail[0]; } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...