Submission #1139921

#TimeUsernameProblemLanguageResultExecution timeMemory
1139921LuvidiCombo (IOI18_combo)C++17
100 / 100
7 ms484 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int n) { string s,p="ABXY",p2; if(press("AB")){ if(press("A"))s="A"; else s="B"; }else{ if(press("X"))s="X"; else s="Y"; } if(n==1)return s; for(char c:p){ if(c!=s[0])p2+=c; } for(int i=0;i<n-2;i++){ int x=press(s+p2[0]+p2[0]+s+p2[0]+p2[1]+s+p2[0]+p2[2]+s+p2[1]); if(x==s.length())s+=p2[2]; else if(x==s.length()+1)s+=p2[1]; else s+=p2[0]; } if(press(s+p2[0]+s+p2[1])!=s.length()){ if(press(s+p2[0])!=s.length())s+=p2[0]; else s+=p2[1]; }else s+=p2[2]; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...