Rezultati

Up. imeNalogaJezikRezultatČas oddaje
cimetovipolzki-2018 Prehod čez cesto Python 3 100/100OK 04. okt '18 @ 19:34

Test Točke Porabljen spomin Porabljen čas Status
#1 9/9 10,957 MiB 0,000 s OK
#2 9/9 11,156 MiB 0,000 s OK
#3 9/9 11,008 MiB 0,000 s OK
#4 9/9 10,715 MiB 0,000 s OK
#5 9/9 10,727 MiB 0,000 s OK
#6 9/9 10,719 MiB 0,000 s OK
#7 9/9 10,547 MiB 0,000 s OK
#8 9/9 10,730 MiB 0,000 s OK
#9 9/9 10,613 MiB 0,000 s OK
#10 9/9 10,617 MiB 0,000 s OK
#11 10/10 10,730 MiB 0,000 s OK

Ocenjevani program (prehod.py):
N, M = [int(i) for i in input().strip().split()]
from fractions import Fraction

state = [False for i in range(M)]
limiters = []

for i in range(M):
    pas, x, v, d = [int(i) for i in input().strip().split()]
    if v < 0:
        v = -v
        x = -x

    if x-d <= 0:
        levi = -Fraction(x, v) - 10 * (pas - 1)
        desni = -Fraction(x-d, v) - 10 * (pas - 1)
        limiters.append((i, levi, 1))
        limiters.append((i, desni, -1))

limiters.sort(key = lambda x: x[1])
onroad = 0
t = 0

for i, time, typ in limiters:
    if onroad == 0 and t >= 0 and time - t > 10: #mogoce manj natancno
        break
    onroad = onroad + typ
    if onroad == 0:
        t = time
    else:
        t = -1
#print(limiters)
print(float(t))