제출 #597158

#제출 시각아이디문제언어결과실행 시간메모리
597158franfill콤보 (IOI18_combo)C++17
100 / 100
33 ms616 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string s; if (press("AB")) if (press("A")) s = "A"; else s = "B"; else if (press("X")) s = "X"; else s = "Y"; if (N == 1) return s; string temp = "ABXY"; string pos = ""; for (auto c : temp) if (c != s[0]) pos += c; for (int i = 1; i < N-1; i++) { int l = s.size(); string q = s + pos[0]; for (auto c : pos) q += s + pos[1] + c; int r = press(q); if (r == l+1) s += pos[0]; else if (r == l+2) s += pos[1]; else s += pos[2]; } int i; for (i = 0; i < 2; i++) if (press(s + pos[i]) == N) break; return s + pos[i]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...