Submission #554318

#TimeUsernameProblemLanguageResultExecution timeMemory
554318n0sk1llCombo (IOI18_combo)C++14
5 / 100
21 ms432 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string c; string guess_sequence(int n) { string s=""; if (press("XY")) { if (press("X")) s="X"; else s="Y"; } else { if (press("A")) s="A"; else s="B"; } if (s=="X") c="ABY"; else if (s=="Y") c="ABX"; else if (s=="A") c="XYB"; else c="XYA"; for (int i=1;i<n-1;i++) { int coins=press(s+c[0]+c[0]+s+c[0]+c[1]+s+c[1]+c[0]+s+c[1]+c[1]); if (coins==i) s+=c[2]; else if (coins>=i+2) { if (press(s+c[0]+c[0]+s+c[1]+c[1])==n) { if (press(s+c[0]+c[0])==n) s+=c[0],s+=c[0]; else s+=c[1],s+=c[1]; } else { if (press(s+c[0]+c[1])==n) s+=c[0],s+=c[1]; else s+=c[1],s+=c[0]; } } else { if (press(s+c[0])>=i+1) s+=c[0],s+=c[2]; else s+=c[1],s+=c[2]; } } if ((int)s.size()<n) { if (press(s+"X"+s+"Y")>n-1) { if (press(s+"X")>n-1) s+="X"; else s+="Y"; } else { if (press(s+"A")>n-1) s+="A"; else s+="B"; } } //cout<<s<<endl; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...