Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 14/14 8,652 MiB 0,000 s OK
#2 14/14 8,656 MiB 0,000 s OK
#3 14/14 8,656 MiB 0,000 s OK
#4 14/14 8,676 MiB 0,000 s OK
#5 14/14 8,613 MiB 0,000 s OK
#6 15/15 8,605 MiB 0,000 s OK
#7 15/15 8,648 MiB 0,000 s OK

Ocenjevani program (zanske_v_avtu.py):
import sys

#sys.stdin = open("mesta.in")

inp = sys.stdin.readline
N, W, H = map(int, inp().split())


avti = []
ending = []
for j in range(N):
    smer, x, y = inp().split()
    x, y = int(x),int(y)
    avti.append([smer, x, y])
    if smer == "G":
        ending.append([x, H])
    else:
        ending.append([W, y])

coll = []

for i in range(len(avti)):
    s, x, y = avti[i]
    for j in range(i+1, len(avti)):
        s2, x2, y2 = avti[j]
        if s == s2:
            continue
        if x-x2 == -(y-y2):
            if x > x2 and s == "D":
                continue
            if x2 > x and s2 == "D":
                continue
            coll.append([i, j, abs(x-x2)])


coll.sort(key = lambda x: -x[-1])
for i,j, _ in coll:
    ending[i], ending[j] = ending[j],ending[i]

for x,y in ending:
    print(x,y)