Rezultati

Up. imeNalogaJezikRezultatČas oddaje
jayzcrew-2018 Priprava naloge Python 3 100/100OK 19. apr '18 @ 16:58

Test Točke Porabljen spomin Porabljen čas Status
#1 11/11 16,324 MiB 0,840 s OK
#2 11/11 16,359 MiB 0,708 s OK
#3 11/11 16,254 MiB 0,835 s OK
#4 11/11 16,270 MiB 0,749 s OK
#5 11/11 16,324 MiB 0,780 s OK
#6 11/11 16,340 MiB 0,694 s OK
#7 11/11 8,590 MiB 0,000 s OK
#8 11/11 10,063 MiB 0,424 s OK
#9 12/12 8,504 MiB 0,000 s OK

Ocenjevani program (priprava.py):
import sys

k,n = list(map(int, input().strip().split()))

casi = []
imp = []

for _ in range(n):
    t, c = list(map(int, input().strip().split()))
    casi.append(t)
    imp.append(c)

SS = sum(imp)

start = 0
window = 0
time = 0
miss = 0
while time < k and window < len(casi):
    time += casi[window]
    miss += imp[window]
    window += 1

if time < k:
    print('Tekma bo polom')
    sys.exit(0)

maks = 0

while start < len(casi):
    maks = max(SS - miss, maks)
    miss -= imp[start]
    time -= casi[start]
    while time < k and window < len(casi):
        time += casi[window]
        miss += imp[window]
        window += 1
    if time < k:
        break
    start += 1

print(maks)