Submission #1146751

#TimeUsernameProblemLanguageResultExecution timeMemory
1146751kvintsekstakordCombo (IOI18_combo)C++20
5 / 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; char other; for(int j = 0; j < 4; j++){ if(chars[j]==S[0]) continue; if(first.size()<2) first.push_back(chars[j]); else other = chars[j]; } vector<string> opts; for(int j = 0; j < 4; j++){ if(chars[j]==S[0]) continue; opts.push_back(S+first[0]+chars[j]); } opts.push_back(S+first[1]); int res = press(opts[0]+opts[1]+opts[2]+opts[3]); if(res==(int)S.size()+2) S+=first[0]; else if(res==(int)S.size()+1) S+=first[1]; else S+=other; } 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...