제출 #123798

#제출 시각아이디문제언어결과실행 시간메모리
123798mlyean00콤보 (IOI18_combo)C++14
100 / 100
40 ms696 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string moves = "ABXY"; string s; void get_first() { if (press("AB") > 0) { if (press("A") > 0) { s = "A"; } else { s = "B"; } } else { if (press("X") > 0) { s = "X"; } else { s = "Y"; } } moves.erase(moves.find(s[0]), 1); } void get_next() { string p = s + moves[0]; for (char c : moves) { p += s; p.push_back(moves[1]); p.push_back(c); } switch (press(p) - s.size()) { case 0: s.push_back(moves[2]); break; case 1: s.push_back(moves[0]); break; case 2: s.push_back(moves[1]); break; } } void get_last() { if (press(s + moves[0] + s + moves[1]) - s.size() == 1) { if (press(s + moves[0]) - s.size() == 1) { s += moves[0]; } else { s += moves[1]; } } else { s += moves[2]; } } string guess_sequence(int N) { get_first(); for (int i = 1; i < N - 1; ++i) get_next(); if (N > 1) get_last(); return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...