제출 #1146766

#제출 시각아이디문제언어결과실행 시간메모리
1146766kvintsekstakord콤보 (IOI18_combo)C++20
0 / 100
0 ms408 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string chars = "ABXY"; string guess_sequence(int N) { string S = ""; if(press("AB")){ S+=(press("A") ? 'A' : 'B'); }else{ S+=(press("X") ? 'X' : 'Y'); } for(int i = 0; i < N-2; i++){ vector<char> first; for(int j = 0; j < 4; j++){ if(chars[j]==S[0]) continue; first.push_back(chars[j]); } vector<string> opts; for(int j = 0; j < 4; j++){ if(chars[j]==S[0]) continue; opts.push_back(S+to_string(first[0])+to_string(chars[j])); } opts.push_back(S+to_string(first[1])); int res = press(opts[0]+opts[1]+opts[2]+opts[3]); if(res==i+3) S+=first[0]; else if(res==i+2) S+=first[1]; else S+=first[2]; } if(N>1){ vector<string> last; for(int j = 0; j < 4; j++){ if(chars[j]==S[0]) continue; last.push_back(S+chars[j]); } if(press(last[0]+last[1])==N){ if(press(last[0])==N){ S=last[0]; }else S=last[1]; }else S=last[2]; } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...