Rezultati

Up. imeNalogaJezikRezultatČas oddaje
lesena-noga-2019 Biodiverziteta Python 3 100/100OK 09. maj '19 @ 19:01

Test Točke Porabljen spomin Porabljen čas Status
#1 [več] 20/20 18,555 MiB 1,091 s OK
#2 [več] 20/20 24,613 MiB 1,424 s OK
#3 [več] 20/20 22,188 MiB 1,340 s OK
#4 [več] 20/20 24,621 MiB 1,628 s OK
#5 [več] 20/20 24,465 MiB 1,663 s OK

Ocenjevani program (bio.py):
import sys
inp = sys.stdin

def razlika (a,b):
    return abs(a.count('A')-b.count('A'))+abs(a.count('C')-b.count('C'))+abs(a.count('G')-b.count('G'))+abs(a.count('T')-b.count('T'))

def racunaj(a_z, a_k, b_z, b_k):
    return (abs())


n_dol_a , m_dol_b, q_vrstic = map(int,inp.readline().split())
niz_a = inp.readline()
niz_b = inp.readline()

A_a = [0] * (len(niz_a) + 1)
C_a = [0] * (len(niz_a) + 1)
G_a = [0] * (len(niz_a) + 1)
T_a = [0] * (len(niz_a) + 1)

A_b = [0] * (len(niz_b) +1)
C_b = [0] * (len(niz_b) +1)
G_b = [0] * (len(niz_b) +1) 
T_b = [0] * (len(niz_b) +1)


for i in range(len(niz_a)):
    if i == 0:
        A_a[i] = 0
        C_a[i] = 0
        G_a[i] = 0
        T_a[i] = 0
    else:
        A_a[i + 1] = A_a[i]
        C_a[i + 1] = C_a[i]
        G_a[i + 1] = G_a[i]
        T_a[i + 1] = T_a[i]
    if niz_a[i] == 'A':
        A_a[i + 1] = A_a[i] + 1
    if niz_a[i] == 'C':
        C_a[i + 1] = C_a[i] + 1
    if niz_a[i] == 'G':
        G_a[i + 1] = G_a[i] + 1
    if niz_a[i] == 'T':
        T_a[i + 1] = T_a[i] + 1

for i in range(len(niz_b)):
    if i == 0:
        A_b[i] = 0
        C_b[i] = 0
        G_b[i] = 0
        T_b[i] = 0
    else:
        A_b[i + 1] = A_b[i]
        C_b[i + 1] = C_b[i]
        G_b[i + 1] = G_b[i]
        T_b[i + 1] = T_b[i]
    if niz_b[i] == 'A':
        A_b[i + 1] = A_b[i] + 1
    if niz_b[i] == 'C':
        C_b[i + 1] = C_b[i] + 1
    if niz_b[i] == 'G':
        G_b[i + 1] = G_b[i] + 1
    if niz_b[i] == 'T':
        T_b[i + 1] = T_b[i] + 1

konec = list()
while q_vrstic > 0:
    q_vrstic= q_vrstic-1
    s_a, t_a ,u_b,v_b= map(int,inp.readline().split())
    a = abs((A_a[t_a] - A_a[s_a - 1]) - (A_b[v_b] - A_b[u_b - 1]))
    c = abs((C_a[t_a] - C_a[s_a - 1]) - (C_b[v_b] - C_b[u_b - 1]))
    g = abs((G_a[t_a] - G_a[s_a - 1]) - (G_b[v_b] - G_b[u_b - 1]))
    t = abs((T_a[t_a] - T_a[s_a - 1]) - (T_b[v_b] - T_b[u_b - 1]))
    tmp = a + c +g +t
    konec.append(tmp)

for i in konec:
    print(i)