Submission #136715

#TimeUsernameProblemLanguageResultExecution timeMemory
136715WongHokFong_cppCombo (IOI18_combo)C++14
100 / 100
47 ms484 KiB
#include <iostream> #include <cstdio> #include "combo.h" #include <string> using namespace std; string a,b,c; int visited[5]; string guess_sequence(int N) { string ans; if (press("AB")>=1) { if (press("A")==1) { ans+="A"; a="B",b="X",c="Y"; } else { ans+="B"; a="A",b="X",c="Y"; } } else { if (press("X")==1) { ans+="X"; a="A",b="B",c="Y"; } else { ans+="Y"; a="A",b="B",c="X"; } } int rec=0; for (int i=2;i<=N-1;i++) { rec=press(ans+a+ans+b+c+ans+b+a+ans+b+b); if (rec==i) ans+=a; else if (rec==i+1) ans+=b; else ans+=c; } if (N==1) return ans; rec=press(ans+a); if (rec==N) { ans+=a;return ans; } rec=press(ans+b); if (rec==N) { ans+=b;return ans; } ans+=c;return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...