Submission #1263577

#TimeUsernameProblemLanguageResultExecution timeMemory
1263577piolkCombo (IOI18_combo)C++20
5 / 100
0 ms408 KiB
#include <bits/stdc++.h> using namespace std; vector<char> buttons={'A','B','X','Y'}; int press(string p); string guess_sequence(int N){ string soFar; vector<char> av; if (press("AB")>0){ if (press("A")==1){ soFar="A"; } else { soFar="B"; } } else { if (press("X")==1){ soFar="X"; } else { soFar="Y"; } } for (int i=0;i<4;i++){ if (buttons[i]==soFar[0]) continue; av.push_back(buttons[i]); } while (soFar.size()<N-1){ int size=soFar.size(); string pat=(soFar+av[0]+av[0]) + (soFar+av[0]+av[1]) + (soFar+av[0]+av[2]) + (soFar+av[1]); int wynik=press(pat); if (wynik>=size+2) soFar.push_back(av[0]); else if (wynik==size+1) soFar.push_back(av[1]); else soFar.push_back(av[2]); } if (press(soFar+av[0])==N){ soFar.push_back(av[0]); } else if (press(soFar+av[1])==N){ soFar.push_back(av[1]); } else { soFar.push_back(av[2]); } return soFar; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...