Submission #413726

#TimeUsernameProblemLanguageResultExecution timeMemory
413726pliamCombo (IOI18_combo)C++14
100 / 100
43 ms524 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string K; string a,b,c; std::string guess_sequence(int N) { //find first letter if(press("AB")){ if(press("B")){ K="B"; a="A"; b="X"; c="Y"; }else{ K="A"; a="B"; b="X"; c="Y"; } }else if(press("X")){ K="X"; a="A"; b="B"; c="Y"; }else{ K="Y"; a="A"; b="B"; c="X"; } int pos=1; while(pos<N-1){ int ans1,ans2; ans1=press(K+a+a+K+b+a+K+a+b)-K.size(); if(ans1==2){ ans2=press(K+a+a)-K.size(); if(ans2==0){ K+=(b+a); pos+=2; continue; }else if(ans2==1){ K+=(a+b); pos+=2; continue; }else{ K+=(a+a); pos+=2; continue; } }else if(ans1==1){ ans2=press(K+b+b)-K.size(); if(ans2==0){ K+=(a+c); pos+=2; continue; }else if(ans2==1){ K+=(b+c); pos+=2; continue; }else{ K+=(b+b); pos+=2; continue; } }else{ K+=c; pos++; continue; } } if(pos==N-1){ if(press(K+a)-K.size()){ K+=a; }else if(press(K+b)-K.size()){ K+=b; }else{ K+=c; } } return K; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...