Rezultati

Up. imeNalogaJezikRezultatČas oddaje
kosmati-mucki-2019 Biodiverziteta Python 3 100/100OK 09. maj '19 @ 17:55

Test Točke Porabljen spomin Porabljen čas Status
#1 [več] 20/20 23,191 MiB 1,799 s OK
#2 [več] 20/20 37,105 MiB 1,922 s OK
#3 [več] 20/20 37,098 MiB 1,886 s OK
#4 [več] 20/20 37,180 MiB 2,095 s OK
#5 [več] 20/20 37,199 MiB 2,145 s OK

Ocenjevani program (lepote.py):
n, m, q = map(int, input().split())
B = input()
D = input()

B_matr = [[0,0,0,0] for _ in range(n+1)]
D_matr = [[0,0,0,0] for _ in range(m+1)]

a = 0
c = 0
g = 0
t = 0
for i in range(n):
    if B[i] == 'A':
        a += 1
    elif B[i] == 'C':
        c += 1
    elif B[i] == 'G':
        g += 1
    else:
        t += 1
    B_matr[i] = [a, c, g, t]

a = 0
c = 0
g = 0
t = 0
for i in range(m):
    if D[i] == 'A':
        a += 1
    elif D[i] == 'C':
        c += 1
    elif D[i] == 'G':
        g += 1
    else:
        t += 1
    D_matr[i] = [a, c, g, t]


for _ in range(q):
    b1, b2, d1, d2 = map(int, input().split())

    B1 = B_matr[b1-2]
    B2 = B_matr[b2-1]

    D1 = D_matr[d1-2]
    D2 = D_matr[d2-1]

    r = 0

    for i in range(4):
        r += abs((B2[i] - B1[i]) - (D2[i] - D1[i]))

    print(r)