제출 #233795

#제출 시각아이디문제언어결과실행 시간메모리
233795Toirov_Sadi콤보 (IOI18_combo)C++17
100 / 100
42 ms688 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N){ string res = "A"; vector<char> a = {'B', 'X', 'Y'}; if(press("AB")){ if(press("B")) res = "B", a = {'A', 'X', 'Y'}; } else{ if(press("X")) res = "X", a = {'A', 'B', 'Y'}; else res = "Y", a = {'A', 'B', 'X'}; } for(int i = 1; i < N - 1; i ++){ string t; t += (res + a[0]); t += (res + a[1] + a[0]); t += (res + a[1] + a[1]); t += (res + a[1] + a[2]); int x = press(t); int sz = (int)res.size(); if(x == sz + 1) res += a[0]; else if(x == sz + 2) res += a[1]; else res += a[2]; } if(N > 1){ string t; t += res + a[0]; t += res + a[1]; if(press(t) == N){ t = res + a[0]; if(press(t) == N) res += a[0]; else res += a[1]; } else{ res += a[2]; } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...