69752023-12-23 13:27:41ParancsmesterJó intervallumokpypy3Time limit exceeded 10/1001.07s169968 KiB
#!/usr/bin/env python3
# NOTE: it is recommended to use this even if you don't understand the following code.

import sys
def main():
    def good(l):
        for i, v in enumerate(l, 1):
            if v%i != 0: return False
        return True

    T = int(input().strip())
    for test in range(1, T+1):
        input()
    
        A = list(map(int, input().strip().split()))
    
        Q = int(input().strip())
    
        L = [0 for i in range(Q)]
        R = [0 for i in range(Q)]
        for y in range(Q):
            L[y], R[y] = map(int, input().strip().split())
    
        ans = [0 for i in range(Q)]
    
        for i in range(Q):
            goodlists = 0
            lst = A[L[i]-1:R[i]]
            for k in range(len(lst)):
                for j in range(k + 1, len(lst) + 1):
                    if good(lst[k:j]): goodlists += 1
            ans[i] = goodlists

        print(*ans, sep='\n')
main()
sys.stdout.close()
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted46ms76688 KiB
subtask210/10
2Accepted87ms88808 KiB
3Accepted96ms88892 KiB
4Accepted112ms88804 KiB
5Accepted197ms88544 KiB
6Accepted823ms90708 KiB
subtask30/20
7Time limit exceeded1.059s29052 KiB
8Time limit exceeded1.031s28680 KiB
9Time limit exceeded1.059s29740 KiB
10Time limit exceeded1.031s29484 KiB
11Time limit exceeded1.047s30332 KiB
subtask40/30
12Time limit exceeded1.054s30528 KiB
13Time limit exceeded1.037s42756 KiB
14Time limit exceeded1.05s31808 KiB
15Runtime error603ms169968 KiB
16Runtime error328ms169660 KiB
subtask50/40
17Time limit exceeded1.07s31160 KiB
18Time limit exceeded1.047s43384 KiB
19Time limit exceeded1.036s33372 KiB
20Runtime error602ms169584 KiB
21Runtime error310ms168840 KiB