Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 [več] 20/20 20,473 MiB 1,587 s OK
#2 [več] 20/20 31,699 MiB 1,862 s OK
#3 [več] 20/20 31,637 MiB 1,563 s OK
#4 [več] 20/20 31,582 MiB 2,014 s OK
#5 [več] 20/20 31,773 MiB 1,953 s OK

Ocenjevani program (bio.py):
l1=input().split()
n=int(l1[0])
m=int(l1[1])
q=int(l1[2])

a=input()
b=input()
'''
for i in range(q):
    l=input().split()
    s=int(l[0])
    t=int(l[1])
    u=int(l[2])
    v=int(l[3])
    A1=0
    C1=0
    G1=0
    T1=0
    A2=0
    C2=0
    G2=0
    T2=0
    for k in range(s-1, t):
        if a[k]=='A':
            A1+=1
        if a[k]=='C':
            C1+=1
        if a[k]=='G':
            G1+=1
        if a[k]=='T':
            T1+=1
    for k in range(u-1, v):
        if b[k]=='A':
            A2+=1
        if b[k]=='C':
            C2+=1
        if b[k]=='G':
            G2+=1
        if b[k]=='T':
            T2+=1
    print(abs(A1-A2)+abs(G1-G2)+abs(C1-C2)+abs(T1-T2))
'''


def izbroj(s):
    l=[(0, 0, 0, 0)]
    t = [0,0,0,0]
    for i in s:
        if i == 'A':
            t[0]+=1
        if i == 'C':
            t[1]+=1
        if i == 'G':
            t[2]+=1
        if i == 'T':
            t[3]+=1
        l.append(tuple(t))
    return l

l1=izbroj(a)
l2=izbroj(b)


for i in range(q):
    l=input().split()
    s=int(l[0])
    t=int(l[1])
    u=int(l[2])
    v=int(l[3])
    tup1=(l1[t][0]-l1[s-1][0], l1[t][1]-l1[s-1][1], l1[t][2]-l1[s-1][2], l1[t][3]-l1[s-1][3])
    tup2=(l2[v][0]-l2[u-1][0], l2[v][1]-l2[u-1][1], l2[v][2]-l2[u-1][2], l2[v][3]-l2[u-1][3])
    r1=abs(tup1[0]-tup2[0])
    r2=abs(tup1[1]-tup2[1])
    r3=abs(tup1[2]-tup2[2])
    r4=abs(tup1[3]-tup2[3])
    print(r1+r2+r3+r4)