제출 #299044

#제출 시각아이디문제언어결과실행 시간메모리
299044lani1akea콤보 (IOI18_combo)C++17
5 / 100
1 ms212 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;
string guess_sequence(int N) {
 int x;
 string s = "";
 char ch[] = {'A', 'B', 'X', 'Y'};
 if (press("AB")) {
   if (press("A")) x = 0;
   else x = 1;
 } else {
   if (press("X")) x = 2;
   else x = 3;
 }
 s += ch[x];
 swap(ch[x], ch[3]);
 for (int i = 1; i < N - 1; ++i) {
   x = press(s + ch[0] + ch[0] + s + ch[0] + ch[1] + s + ch[0] + ch[2] + s + ch[1]);
   if (x == i + 2) s += ch[0];
   else if (x == i + 1) s += ch[1];
   else s += ch[2];
 }
 if (press(s + ch[0] + s + ch[1]) == N) {
   if (press(s + ch[0]) == N) s += ch[0];
   else s += ch[1];
 } else s += ch[2];
 return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...