Rezultati

Up. imeNalogaJezikRezultatČas oddaje
zerodays-2018 Zaletavanje Python 3 100/100OK 19. apr '18 @ 20:04

Test Točke Porabljen spomin Porabljen čas Status
#1 14/14 8,574 MiB 0,000 s OK
#2 14/14 8,480 MiB 0,000 s OK
#3 14/14 8,656 MiB 0,000 s OK
#4 14/14 8,520 MiB 0,000 s OK
#5 14/14 8,523 MiB 0,000 s OK
#6 15/15 8,695 MiB 0,000 s OK
#7 15/15 8,691 MiB 0,000 s OK

Ocenjevani program (avtorcki2.py):
n, w, h = map(int, input().split())

avti = []
gor = []
desno = []

for i in range(n):
    smer, x, y = input().split()
    avti.append((int(x), int(y)))
    if smer == 'G':
        gor.append(i)
    else:
        desno.append(i)

zaletijo = [(-1, -1) for _ in range(n)]
for avto in gor:
    zaletijo[avto] = (avti[avto][0], h)
for avto in desno:
    zaletijo[avto] = (w, avti[avto][1])


presecisca = []
for i in desno:
    for j in gor:
        if avti[j][0] - avti[i][0] == avti[i][1] - avti[j][1] and (avti[i][1] - avti[j][1]) > 0 and avti[j][0] - avti[i][0] > 0:
            presecisca.append((i, j, avti[i][1] - avti[j][1]))

presecisca.sort(key=lambda x: x[2])
# print(presecisca)

zamenjave = [i for i in range(n)]

for presecisce in presecisca:
    m, n, t = presecisce

    mi = zamenjave.index(m)
    ni = zamenjave.index(n)

    zamenjave[mi], zamenjave[ni] = n, m
    # print(zamenjave)

    # print('swapamo', m, n)
    # print('zares', nov_m, nov_n)
    # print(zaletijo)

# print(zaletijo)

for i in range(len(avti)):
    print(*zaletijo[zamenjave[i]])