Rezultati

Up. imeNalogaJezikRezultatČas oddaje
kjejenovictk-2018 Priprava naloge Python 3 0/100Prekoračen čas (TLE) 19. apr '18 @ 17:48

Test Točke Porabljen spomin Porabljen čas Status
#1 11/11 24,082 MiB 0,154 s OK
#2 11/11 23,852 MiB 0,250 s OK
#3 11/11 25,125 MiB 0,260 s OK
#4 11/11 24,160 MiB 0,316 s OK
#5 0/11 24,949 MiB 4,495 s Prekoračen čas
#6 0/11 23,723 MiB 4,511 s Prekoračen čas
#7 11/11 8,500 MiB 0,000 s OK
#8 0/11 17,230 MiB 4,489 s Prekoračen čas
#9 12/12 8,496 MiB 0,000 s OK

Ocenjevani program (pripravaNaloge.py):
import sys

vrstice = sys.stdin.readlines()
"""
with open("test","r") as f:
    vrstice = f.readlines()
"""
k, n = list(map(int, vrstice[0].strip().split(" ")))
vrstice = vrstice[1:]

t = []
c = []

for vrst in vrstice:
    temp = vrst.strip().split(" ")
    t.append(int(temp[0]))
    c.append(int(temp[1]))

max_c = 0
full_score = sum(c)

if k > sum(t):
    print("Tekma bo polom")

else:
    for i in range(n):
        j = i
        cur_t = 0
        cur_c = 0

        while k > cur_t:
            if j >= n:
                cur_c = full_score
                break

            cur_t += t[j]
            cur_c += c[j]

            j += 1

        if (full_score - cur_c) > max_c:
            max_c = full_score - cur_c

    print(max_c)