Submission #315514

# Submission time Handle Problem Language Result Execution time Memory
315514 2020-10-23T02:35:05 Z Flugan42 Combo (IOI18_combo) C++14
Compilation error
0 ms 0 KB
def guess_sequence(N, press):
    ans = press("AB")
    fst = ""
    if ans:
        ans = press("A")
        if ans:
            fst = "A"
        else:
            fst = "B"
    else:
        ans = press("X")
        if ans:
            fst = "X"
        else:
            fst = "Y"

    other = []
    for tmp in "ABXY":
        if tmp != fst:
            other.append(tmp)

    S = fst
    for i in range(1,N-1):
        ans = press(S+other[0]+other[0]+S+other[0]+other[1]+S+other[0]+other[2]+S+other[1])
        if ans == i+2:
            S += other[0]
        elif ans == i+1:
            S += other[1]
        else:
            S += other[2]

    ans = press(S+other[0])
    if ans == N:
        return S+other[0]

    ans = press(S+other[1])
    if ans == N:
        return S+other[1]

    return S+other[2]
    

Compilation message

combo.cpp:1:1: error: 'def' does not name a type
    1 | def guess_sequence(N, press):
      | ^~~