제출 #1017091

#제출 시각아이디문제언어결과실행 시간메모리
1017091eldorbek_008콤보 (IOI18_combo)C++17
100 / 100
23 ms1536 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define len(x) (int)(x).size() std::string guess_sequence(int N) { string a; int x = press("AB"); if (x > 0) { x = press("B"); if (x > 0) { a = "B"; } else { a = "A"; } } else { x = press("Y"); if (x > 0) { a = "Y"; } else { a = "X"; } } string r = "ABXY"; r.erase(r.begin() + r.find(a)); if (N >= 2) { for (int i = 0; i < N - 2; i++) { string cur = a + r[1] + a + r[0] + r[1] + a + r[0] + r[0] + a + r[0] + r[2]; int y = press(cur); if (y == len(a) + 1) { a += r[1]; // only a + r[1] can make len(a) + 1 } else if (y == len(a) + 2) { a += r[0]; // next char must be r[0] } else { a += r[2]; // last choice } } string last = a + r[0] + a + r[1]; x = press(last); if (x == len(a) + 1) { last = a + r[0]; x = press(last); if (x == len(a)) { a += r[1]; } else { a += r[0]; } } else { a += r[2]; } } return a; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...