Rezultati

Up. imeNalogaJezikRezultatČas oddaje
cimetovipolzki-2017 Pakiranje piva Python 3 0/100Prekoračen čas (TLE) 20. apr '17 @ 19:38

Test Točke Porabljen spomin Porabljen čas Status
#1 3/3 8,590 MiB 0,000 s OK
#2 3/3 8,598 MiB 0,000 s OK
#3 3/3 8,621 MiB 0,000 s OK
#4 3/3 8,594 MiB 0,000 s OK
#5 3/3 8,605 MiB 0,000 s OK
#6 3/3 8,609 MiB 0,000 s OK
#7 3/3 8,590 MiB 0,000 s OK
#8 0/3 8,484 MiB 4,557 s Prekoračen čas
#9 3/3 8,602 MiB 0,000 s OK
#10 3/3 8,586 MiB 0,000 s OK
#11 3/3 8,633 MiB 0,000 s OK
#12 3/3 8,625 MiB 0,000 s OK
#13 3/3 8,633 MiB 0,000 s OK
#14 3/3 8,652 MiB 0,000 s OK
#15 3/3 8,641 MiB 0,000 s OK
#16 3/3 8,590 MiB 0,000 s OK
#17 3/3 8,664 MiB 0,000 s OK
#18 3/3 8,637 MiB 0,000 s OK
#19 0/3 8,504 MiB 4,554 s Prekoračen čas
#20 0/3 8,496 MiB 4,544 s Prekoračen čas
#21 0/3 8,516 MiB 4,570 s Prekoračen čas
#22 0/3 8,512 MiB 4,570 s Prekoračen čas
#23 0/3 8,520 MiB 4,565 s Prekoračen čas
#24 0/3 8,520 MiB 4,549 s Prekoračen čas
#25 0/4 8,523 MiB 4,590 s Prekoračen čas
#26 4/4 8,625 MiB 0,000 s OK
#27 4/4 8,637 MiB 2,773 s OK
#28 4/4 8,629 MiB 0,000 s OK
#29 4/4 8,621 MiB 0,000 s OK
#30 4/4 8,648 MiB 0,000 s OK
#31 4/4 8,637 MiB 0,266 s OK

Ocenjevani program (naloga6.py):
def je_dober(k, a):
    if a % k == 0:
        m = 0
    else:
        m = k - a % k;
    n = (a + m) // k;
    return n >= m;

def najdi_dobrega(m):
    for i in range(m+1):
        if je_dober(m + 1 - i, m):
            yield m + 1 -i


T = int(input())

array = []
for i in range(T):
    a = int(input())
    array.append(a)

m = min(array)
dobri = najdi_dobrega(m)
k = next(dobri)
while True:
    ni_dober = False
    for i in array:
        if not je_dober(k, i):
            k = next(dobri)
            ni_dober = True
            break
    if not ni_dober:
        print(k)
        break