제출 #1017084

#제출 시각아이디문제언어결과실행 시간메모리
1017084eldorbek_008콤보 (IOI18_combo)C++17
5 / 100
1 ms344 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[0])); // cout << r << endl; 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.push_back(r[1]); // only a + r[1] can make len(a) + 1 } else if (y == len(a) + 2) { a.push_back(r[0]); // next char must be r[0] } else { a.push_back(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.push_back(r[1]); } else { a.push_back(r[0]); } } else { a.push_back(r[2]); } return a; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...