Submission #1289486

#TimeUsernameProblemLanguageResultExecution timeMemory
1289486Math4Life2020Combo (IOI18_combo)C++20
0 / 100
1 ms400 KiB
#include <bits/stdc++.h> using namespace std; using ll = int; using pii = pair<ll,ll>; using str = string; #include "combo.h" string guess_sequence(int N) { str cstr = ""; str let[8]; let[0]="A"; let[1]="B"; let[2]="X"; let[3]="Y"; let[4]="A"; let[5]="B"; let[6]="X"; let[7]="Y"; ll st0 = -1; if (press("AB")==1) { if (press("A")==1) { st0=0; } else { st0=1; } } else { if (press("X")==1) { st0=2; } else { st0=3; } } cstr = let[st0]; while (cstr.size()<N) { if (cstr.size()==(N-1)) { if (press(cstr+let[st0+1])==N) { cstr += let[st0+1]; } else if (press(cstr+let[st0+2])==N) { cstr += let[st0+2]; } else { cstr += let[st0+3]; } } else { str qry = cstr + let[st0+1] + cstr + let[st0+2] + let[st0+1] + cstr + let[st0+2] + let[st0+2] + cstr + let[st0+2] + let[st0+3]; ll val = press(qry); ll K = cstr.length(); if (val==K) { cstr += let[st0+3]; } else if (val==(K+1)) { cstr += let[st0+1]; } else { assert(val==(K+2)); cstr += let[st0+2]; } } } return cstr; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...