Submission #670979

#TimeUsernameProblemLanguageResultExecution timeMemory
67097975_yabukiCombo (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...