Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 14/14 8,496 MiB 0,000 s OK
#2 14/14 8,586 MiB 0,000 s OK
#3 14/14 8,574 MiB 0,000 s OK
#4 14/14 8,598 MiB 0,000 s OK
#5 14/14 8,691 MiB 0,000 s OK
#6 15/15 8,676 MiB 0,000 s OK
#7 15/15 8,734 MiB 0,330 s OK

Ocenjevani program (zaletavanje.py):
N, W, H = [int(x) for x in input().split()]
avto = [0 for _ in range(N)]
for i in range(N):
    line = input().split()
    avto[i] = [line[0], int(line[1]), int(line[2])]

koncne_lege = [
    [avto[i][1], H] if avto[i][0] == 'G' else [W, avto[i][2]]
    for i in range(N)
]

gor = []
desno = []
for i in range(N):
    if avto[i][0] == 'G':
        gor.append(i)
    else:
        desno.append(i)

trki = []
for g in gor:
    for d in desno:
        xg, yg = avto[g][1], avto[g][2]
        xd, yd = avto[d][1], avto[d][2]

        if xg > xd and yd > yg and abs(xg - xd) == abs(yg - yd):
            trki.append([abs(xg-xd), xg, yd, g, d])
trki.sort(key=lambda x: x[0])

for i, e in enumerate(trki):
    g = e[3]
    d = e[4]
    for j in range(i+1,len(trki)):
        tg = trki[j][3]
        td = trki[j][4]
        if tg == g:
            trki[j][3] = d
        elif tg == d:
            trki[j][3] = g
        if td == d:
            trki[j][4] = g
        elif td == g:
            trki[j][4] = d

    koncne_lege[g], koncne_lege[d] = koncne_lege[d], koncne_lege[g]

for l in koncne_lege:
    print(' '.join([str(x) for x in l]))