Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 11/11 53,262 MiB 1,474 s OK
#2 11/11 52,883 MiB 1,394 s OK
#3 11/11 52,836 MiB 1,474 s OK
#4 11/11 53,012 MiB 1,540 s OK
#5 11/11 53,117 MiB 1,424 s OK
#6 11/11 52,133 MiB 1,460 s OK
#7 11/11 8,594 MiB 0,000 s OK
#8 11/11 41,305 MiB 1,144 s OK
#9 12/12 8,586 MiB 0,000 s OK

Ocenjevani program (priprava_naloge.py):
[k, n] = list(map(int, input().strip().split(' ')))
dogodki = [list(map(int, input().strip().split(' '))) for i in range(n)]
skupen_cas = sum(map(lambda x : x[0], dogodki))
pomembnost = sum(map(lambda x : x[1], dogodki))

if skupen_cas < k:
    print('Tekma bo polom')

else:
    sez = [[0, 0, 0, 0] for i in range(n)]
    for i in range(n):
        if i == 0:
            t = dogodki[i][0]
            pom = dogodki[i][1]
            j = 0
            while (t < k) and (j < n-1):
                j += 1
                t += dogodki[j][0]
                pom += dogodki[j][1]
        else:
            t = sez[i-1][2] - dogodki[i-1][0]
            pom = sez[i-1][3] - dogodki[i-1][1]
            j = sez[i-1][1]
            while (t < k) and (j < n-1):
                j += 1
                t += dogodki[j][0]
                pom += dogodki[j][1]
        if j == n-1 and t < k:
            pom = pomembnost
        sez[i] = [i, j, t, pom]
    print(pomembnost - sorted(sez, key=lambda x: x[3])[0][3])