제출 #1030912

#제출 시각아이디문제언어결과실행 시간메모리
1030912Ludissey콤보 (IOI18_combo)C++14
100 / 100
25 ms1960 KiB
#include "combo.h" #include <bits/stdc++.h> #define sz(a) (int)a.size() #define all(a) a.begin(), a.end() using namespace std; string guess_sequence(signed N){ string start="A"; string p="AB"; int r=press(p); if(r>=1){ p="A"; r=press(p); if(r>=1) start="A"; else start="B"; }else { p="X"; r=press(p); if(r>=1) start="X"; else start="Y"; } vector<string> others; if(start!="A") others.push_back("A"); if(start!="B") others.push_back("B"); if(start!="X") others.push_back("X"); if(start!="Y") others.push_back("Y"); for (int i = 1; i < N-1; i++) { string tp=""; tp+=start+others[0]; for (int j = 0; j < 3; j++) { tp+=start+others[1]+others[j]; } r=press(tp); if(r<i+1){ start+=others[2]; }else if(r==i+1){ start+=others[0]; }else { start+=others[1]; } } for (int i = 0; i < 2&&N>1; i++){ string tp=start; tp+=others[i]; if(press(tp)==N) { start+=others[i]; break; }else if(i==1){ start+=others[i+1]; break; } } return start; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...