Rezultati

Up. imeNalogaJezikRezultatČas oddaje
kjejenovictk-2018 Podnapisi Python 3 100/100OK 10. maj '18 @ 18:53

Test Točke Porabljen spomin Porabljen čas Status
#1 7/7 8,809 MiB 0,000 s OK
#2 7/7 8,922 MiB 0,000 s OK
#3 7/7 8,594 MiB 0,000 s OK
#4 7/7 9,328 MiB 0,000 s OK
#5 7/7 8,664 MiB 0,000 s OK
#6 7/7 8,414 MiB 0,000 s OK
#7 7/7 8,645 MiB 0,000 s OK
#8 7/7 8,605 MiB 0,000 s OK
#9 7/7 8,566 MiB 0,000 s OK
#10 7/7 9,254 MiB 0,000 s OK
#11 7/7 8,504 MiB 0,000 s OK
#12 7/7 8,629 MiB 0,000 s OK
#13 8/8 8,734 MiB 0,000 s OK
#14 8/8 8,672 MiB 0,000 s OK

Ocenjevani program (podnapisi.py):
import sys

data = sys.stdin.readlines()

#data = open("podnapisi.txt").readlines()

i = -1
for vrstica in data:
    vrstica = vrstica.strip("\n")
    if i == -1:
        shift = vrstica.split(":")[1:]
        lastShift = shift[-1].split(",")
        shift = list(map(int, shift[:-1]))
        lastShift = list(map(int, lastShift))
    else:
        if len(vrstica) == 0:
            i = 0
            print()
            continue
        if i == 1:
            obeMeji = vrstica.split(" --> ")
            meja1 = obeMeji[0].split(":")
            last1 = meja1[-1].split(",")
            meja2 = obeMeji[1].split(":")
            last2 = meja2[-1].split(",")
            ostanek1 = 0
            ostanek2 = 0
            ostanek3 = 0
            ostanek4 = 0
            for j in [1,0]:
                last1[j] = int(last1[j]) + lastShift[j] + ostanek1
                last2[j] = int(last2[j]) + lastShift[j] + ostanek2
                if j == 1:
                    ostanek1 = last1[j] // 1000
                    last1[j] = last1[j] % 1000
                    ostanek2 = last2[j] // 1000
                    last2[j] = last2[j] % 1000
                else:
                    ostanek3 = last1[j] // 60
                    last1[j] = last1[j] % 60
                    ostanek4 = last2[j] // 60
                    last2[j] = last2[j] % 60

            for j in [1, 0]:

                meja1[j] = int(meja1[j]) + shift[j] + ostanek3
                meja2[j] = int(meja2[j]) + shift[j] + ostanek4
                if j == 1:
                    ostanek3 = meja1[j] // 60
                    meja1[j] = meja1[j] % 60
                    ostanek4 = meja2[j] // 60
                    meja2[j] = meja2[j] % 60

            meja1[0] = int(meja1[0])
            meja1[1] = int(meja1[1])
            last1 = list(map(str, last1))
            if len(last1[0]) == 1:
                last1[0] = "0" + last1[0]
            if len(last1[1]) == 1:
                last1[1] = "00" + last1[1]
            elif len(last1[1]) == 2:
                last1[1] = "0" + last1[1]
            meja1[2] = ",".join(last1)
            meja2[0] = int(meja2[0])
            meja2[1] = int(meja2[1])
            last2 = list(map(str, last2))
            if len(last2[0]) == 1:
                last2[0] = "0" + last2[0]
            if len(last2[1]) == 1:
                last2[1] = "00" + last2[1]
            elif len(last2[1]) == 2:
                last2[1] = "0" + last2[1]
            meja2[2] = ",".join(last2)

            meja1 = list(map(str, meja1))
            meja2 = list(map(str, meja2))

            for j in [0, 1]:
                if len(meja1[j]) == 1:
                    meja1[j] = "0" + meja1[j]
                if len(meja2[j]) == 1:
                    meja2[j] = "0" + meja2[j]

            meja1 = ":".join(meja1)
            meja2 = ":".join(meja2)

            print("{} --> {}".format(meja1, meja2))

        else:
            print(vrstica)
    i += 1