제출 #862960

#제출 시각아이디문제언어결과실행 시간메모리
862960HataNoKokoro콤보 (IOI18_combo)C++17
100 / 100
15 ms2112 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; char c_list[3]; string guess_sequence(int N) { string result = ""; int coin; ///ask first char coin = press("AB"); if(coin == 0) { c_list[0] = 'A'; c_list[1] = 'B'; result += (press("X") ? 'X' : 'Y'); c_list[2] = (result[0] == 'X' ? 'Y' : 'X'); } else { result += (press("A") ? 'A' : 'B'); c_list[0] = (result[0] == 'A' ? 'B' : 'A'); c_list[1] = 'X'; c_list[2] = 'Y'; } ///ask 2 -> n-1 char for(int i = 2; i < N; i++) { coin = press(result + c_list[0] + c_list[0] + result + c_list[0] + c_list[1] +result + c_list[0] + c_list[2] + result + c_list[1]); if(coin == i + 1) result += c_list[0]; else if(coin == i) result += c_list[1]; else result += c_list[2]; } if(N == 1) return result; ///ask n char coin = press(result + c_list[0] + result + c_list[1]); if(coin == N) return (press(result + c_list[0]) == N ? result + c_list[0] : result + c_list[1]); return result + c_list[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...