제출 #670979

#제출 시각아이디문제언어결과실행 시간메모리
67097975_yabuki콤보 (IOI18_combo)C++14
100 / 100
29 ms552 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; vector<char> cand = {'A', 'B', 'X', 'Y'}; vector<char> V; std::string guess_sequence(int N) { std::string S = ""; if(press("AB")){ if(press("A")) S = "A"; else S = "B"; } else{ if(press("X")) S = "X"; else S = "Y"; } if(N == 1) return S; for(auto v : cand){ if(v == S[0]) continue; else V.push_back(v); } // for(auto v : V) cout << v << endl; while((int) S.size() < N-1){ string query = S + V[0] + S + V[1] + V[0] + S + V[1] + V[1] + S + V[1] + V[2]; // SXSYBSYXSYY int ret = press(query); if(ret == (int) S.size()) S += V[2]; else if(ret == (int) S.size() + 1) S += V[0]; else S += V[1]; } if(press(S + V[0]) == N){ S += V[0]; } else if(press(S + V[1]) == N){ S += V[1]; } // else return S + V[2]; else S += V[2]; // cout << S << endl; return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...