66562023-12-15 17:06:05almaaaJó intervallumokpython3Wrong answer 0/1001.082s27976 KiB
def szepe(sorozat):
    jo = True
    for i in range(len(sorozat)):
        if sorozat[i]%(i+1) != 0:
            jo =False
    if jo == True:
        return True
    elif jo == False:
        return False

def osszjo(sorozat):
    ossz = 0
    for i in range(len(sorozat)):
        for j in range(i,len(sorozat)):
            act = sorozat[i:j+1]
            if szepe(act) == True:
                ossz+=1
    return(ossz)

t = int(input())
n = int(input())
a = input().split()
a = list(map(int,a))
q = int(input())
qs = []
for i in range(q):
    qi=input().split()
    qi=list(map(int,qi))
    qi=[x-1 for x in qi]
    qs.append(qi)

for i in range(len(qs)):
    actlist = a[qs[i][0]:qs[i][1]+1]
    print(osszjo(actlist))
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted18ms11492 KiB
subtask20/10
2Wrong answer21ms11964 KiB
3Wrong answer52ms12308 KiB
4Wrong answer305ms12580 KiB
5Time limit exceeded1.067s12680 KiB
6Time limit exceeded1.067s4980 KiB
subtask30/20
7Time limit exceeded1.067s6044 KiB
8Time limit exceeded1.075s8080 KiB
9Time limit exceeded1.069s9956 KiB
10Time limit exceeded1.072s12412 KiB
11Time limit exceeded1.082s20668 KiB
subtask40/30
12Time limit exceeded1.065s7840 KiB
13Time limit exceeded1.072s10052 KiB
14Time limit exceeded1.069s13044 KiB
15Time limit exceeded1.072s16784 KiB
16Time limit exceeded1.062s27572 KiB
subtask50/40
17Time limit exceeded1.072s8764 KiB
18Time limit exceeded1.044s10812 KiB
19Time limit exceeded1.052s13544 KiB
20Time limit exceeded1.065s17160 KiB
21Time limit exceeded1.054s27976 KiB