33042023-02-24 18:44:2112BotiHanoi tornyai variáns (45)python3Wrong answer 0/45127ms23696 KiB

pos = [-1] * 16
for t in range(3):
    for d in input().split()[:-1]:
        pos[int(d) - 1] = t

wantedpos = [-1] * 16
for t in range(3):
    for d in input().split()[:-1]:
        wantedpos[int(d) - 1] = t

moves = []


def move(d, to):
    if pos[d] == -1 or pos[d] == to:
        return
    # print(f"move {d+1} to tower {to}")
    for e in range(d - 1, -1, -1):
        move(e, 3 - pos[d] - to)
    moves.append((pos[d], to))
    pos[d] = to


for d in range(15, -1, -1):
    # print("doing", d + 1)
    move(d, wantedpos[d])

print(len(moves))
for f, t in moves:
    print(f + 1, t + 1)
SubtaskSumTestVerdictTimeMemory
base0/45
1Wrong answer0/018ms11296 KiB
2Wrong answer0/017ms11236 KiB
3Wrong answer0/217ms11708 KiB
4Wrong answer0/217ms12028 KiB
5Wrong answer0/217ms12136 KiB
6Wrong answer0/317ms12404 KiB
7Wrong answer0/217ms12308 KiB
8Wrong answer0/217ms12796 KiB
9Wrong answer0/218ms12964 KiB
10Wrong answer0/218ms13336 KiB
11Wrong answer0/218ms13620 KiB
12Wrong answer0/219ms13908 KiB
13Wrong answer0/224ms14364 KiB
14Wrong answer0/229ms14968 KiB
15Wrong answer0/263ms18052 KiB
16Wrong answer0/286ms19988 KiB
17Wrong answer0/279ms19604 KiB
18Wrong answer0/2125ms23172 KiB
19Wrong answer0/382ms19572 KiB
20Wrong answer0/3118ms22732 KiB
21Wrong answer0/3127ms23696 KiB
22Wrong answer0/397ms21672 KiB