11766 | 2024-11-09 17:02:40 | balint | Sokszorozott maximumok | python3 | Time limit exceeded 11/100 | 2.101s | 26500 KiB |
from math import prod
from heapq import nlargest
def main():
MOD = 10**9 + 7
N, Q = map(int, input().split())
nums = list(map(int, input().split()))
for _ in range(Q):
L, R, k = map(int, input().split())
sub = nums[L : R + 1]
# mul = reduce(memo_mul, sorted(sub, reverse=True)[:k], 1)
mul = prod(nlargest(k, sub))
print(mul % MOD)
main()
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 16ms | 3128 KiB | ||||
subtask2 | 11/11 | ||||||
2 | Accepted | 32ms | 3304 KiB | ||||
3 | Accepted | 41ms | 3132 KiB | ||||
4 | Accepted | 326ms | 3528 KiB | ||||
5 | Accepted | 828ms | 3640 KiB | ||||
6 | Accepted | 18ms | 3080 KiB | ||||
7 | Accepted | 212ms | 3272 KiB | ||||
subtask3 | 0/13 | ||||||
8 | Accepted | 29ms | 3124 KiB | ||||
9 | Accepted | 32ms | 3176 KiB | ||||
10 | Accepted | 239ms | 3312 KiB | ||||
11 | Time limit exceeded | 2.078s | 14072 KiB | ||||
12 | Time limit exceeded | 2.082s | 26312 KiB | ||||
13 | Time limit exceeded | 2.101s | 26188 KiB | ||||
subtask4 | 0/19 | ||||||
14 | Time limit exceeded | 2.082s | 21576 KiB | ||||
15 | Time limit exceeded | 2.082s | 23996 KiB | ||||
16 | Time limit exceeded | 2.082s | 26500 KiB | ||||
17 | Time limit exceeded | 2.079s | 26252 KiB | ||||
18 | Time limit exceeded | 2.076s | 26196 KiB | ||||
subtask5 | 0/25 | ||||||
19 | Time limit exceeded | 2.073s | 9384 KiB | ||||
20 | Time limit exceeded | 2.073s | 8396 KiB | ||||
21 | Time limit exceeded | 2.075s | 8204 KiB | ||||
22 | Time limit exceeded | 2.073s | 9224 KiB | ||||
23 | Time limit exceeded | 2.089s | 6888 KiB | ||||
subtask6 | 0/32 | ||||||
24 | Time limit exceeded | 2.094s | 26404 KiB | ||||
25 | Time limit exceeded | 2.092s | 26196 KiB | ||||
26 | Time limit exceeded | 2.092s | 21572 KiB | ||||
27 | Time limit exceeded | 2.094s | 23900 KiB | ||||
28 | Time limit exceeded | 2.082s | 26276 KiB | ||||
29 | Time limit exceeded | 2.082s | 26188 KiB | ||||
30 | Time limit exceeded | 2.082s | 24040 KiB |