6975 | 2023-12-23 13:27:41 | Parancsmester | Jó intervallumok | pypy3 | Time limit exceeded 10/100 | 1.07s | 169968 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()
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 46ms | 76688 KiB | ||||
subtask2 | 10/10 | ||||||
2 | Accepted | 87ms | 88808 KiB | ||||
3 | Accepted | 96ms | 88892 KiB | ||||
4 | Accepted | 112ms | 88804 KiB | ||||
5 | Accepted | 197ms | 88544 KiB | ||||
6 | Accepted | 823ms | 90708 KiB | ||||
subtask3 | 0/20 | ||||||
7 | Time limit exceeded | 1.059s | 29052 KiB | ||||
8 | Time limit exceeded | 1.031s | 28680 KiB | ||||
9 | Time limit exceeded | 1.059s | 29740 KiB | ||||
10 | Time limit exceeded | 1.031s | 29484 KiB | ||||
11 | Time limit exceeded | 1.047s | 30332 KiB | ||||
subtask4 | 0/30 | ||||||
12 | Time limit exceeded | 1.054s | 30528 KiB | ||||
13 | Time limit exceeded | 1.037s | 42756 KiB | ||||
14 | Time limit exceeded | 1.05s | 31808 KiB | ||||
15 | Runtime error | 603ms | 169968 KiB | ||||
16 | Runtime error | 328ms | 169660 KiB | ||||
subtask5 | 0/40 | ||||||
17 | Time limit exceeded | 1.07s | 31160 KiB | ||||
18 | Time limit exceeded | 1.047s | 43384 KiB | ||||
19 | Time limit exceeded | 1.036s | 33372 KiB | ||||
20 | Runtime error | 602ms | 169584 KiB | ||||
21 | Runtime error | 310ms | 168840 KiB |