Submission #701051

#TimeUsernameProblemLanguageResultExecution timeMemory
701051BobCompetitiveProgrammingCombo (IOI18_combo)C++14
100 / 100
34 ms792 KiB
#include <bits/stdc++.h> using namespace std; using ll=long long; int press(std::string p); string guess_sequence(int N){ string S = "", first, a1, a2, a3; if(press("AB")) { if(press("A")) first="A", S="A", a1="B", a2="X", a3="Y"; else first="B", S="B", a1="A", a2="X", a3="Y"; } else { if(press("X")) first="X", S="X", a1="B", a2="A", a3="Y"; else first="Y", S="Y", a1="B", a2="X", a3="A"; } vector<string> a{a1, a2, a3}; while(true){ int curr_size = S.size(); if(curr_size == N) return S; if(curr_size<=N-2){ ll nxt = press(S+a1+a1 + S+a1+a2 + S+a1+a3 + S+a2) - curr_size; if(nxt==2) S+=a1; if(nxt==1) S+=a2; if(nxt==0) S+=a3; } else { if(press(S+a1+S+a2)>curr_size){ if(press(S+a1)>curr_size) S+=a1; else S+=a2; } else S+=a3; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...