Submission #95944

#TimeUsernameProblemLanguageResultExecution timeMemory
95944errorgornCombo (IOI18_combo)C++14
100 / 100
54 ms616 KiB
#include "combo.h" #include <string> #include <iostream> using namespace std; std::string guess_sequence(int N) { string c=""; string test=""; char l[]={'A','B','X','Y'},arr[3]; if (press("AB")>0){ if (press("A")==1) c="A"; else c="B"; } else{ if (press("X")==1)c="X"; else c="Y"; } if (N==1) return c; int y=-1; for (int x=0;x<3;x++){ y++; if (c[0]==l[y]){ x--; continue; } arr[x]=l[y]; } N--; for (int x=1;x<N;x++){ test=c+arr[1]+c+arr[2]+arr[0]+c+arr[2]+arr[1]+c+arr[2]+arr[2]; y=press(test)-x; c+=arr[y]; } N++; if (press(c+"A"+c+"B")==N){ if (press(c+"A")==N) c+="A"; else c+="B"; } else{ if (press(c+"X")==N)c+="X"; else c+="Y"; } return c; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...