Submission #309725

#TimeUsernameProblemLanguageResultExecution timeMemory
309725wildturtleCombo (IOI18_combo)C++14
100 / 100
39 ms616 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string ans,s,s1; int a,n; n=N; if(press("AB")>=1) { if(press("A")==1) { ans="A"; s1="BXY"; } else { s1="AXY"; ans="B"; } } else if(press("X")==1) { ans="X"; s1="ABY"; } else { s1="ABX"; ans="Y"; } if(n==1) return ans; for(long long i=2;i<n;i++) { s=ans+s1[0]+ans+s1[1]+s1[0]+ans+s1[1]+s1[1]+ans+s1[1]+s1[2]; a=press(s); if(a==i-1) ans+=s1[2]; else if(a==i) ans+=s1[0]; else ans+=s1[1]; } s=ans+s1[0]+ans+s1[1]; if(press(s)==n) { s=ans+s1[0]; if(press(s)==n) ans=ans+s1[0]; else ans=ans+s1[1]; } else ans=ans+s1[2]; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...