Rezultati

Up. imeNalogaJezikRezultatČas oddaje
vlakectomaz-2018 Priprava naloge Python 3 100/100OK 19. apr '18 @ 17:44

Test Točke Porabljen spomin Porabljen čas Status
#1 11/11 16,398 MiB 0,749 s OK
#2 11/11 16,242 MiB 0,744 s OK
#3 11/11 16,398 MiB 0,612 s OK
#4 11/11 16,246 MiB 0,708 s OK
#5 11/11 16,234 MiB 0,603 s OK
#6 11/11 16,391 MiB 0,598 s OK
#7 11/11 8,496 MiB 0,000 s OK
#8 11/11 10,203 MiB 0,414 s OK
#9 12/12 8,660 MiB 0,000 s OK

Ocenjevani program (priprava.py):
k, n = [int(x) for x in input().split(" ")]
T,C=[],[]
vsota_ur,vsota_p=0, 0
for i in range(0,n):
   t, c = [int(x) for x in input().split(" ")] 
   T.append(t)
   C.append(c)
   vsota_ur+=c
   vsota_p+=t
a=0
b=0
X,Y,A=vsota_ur,vsota_p,0
B=vsota_ur
maks=-1
while(1):
    if(A<k):
        if(b==n):
            break
        A+=T[b]
        B-=C[b]
        b+=1
        continue

    if(A>=k):
        if(B>maks):
            maks=B
        A-=T[a]
        B+=C[a]
        a+=1
        continue
    

if(maks==-1):
    print('Tekma bo polom')
else: 
    print(maks)