117632024-11-09 16:20:06balintSokszorozott maximumokpython3Time limit exceeded 11/1002.095s27792 KiB
from math import prod


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]
        print(prod(sorted(sub, reverse=True)[:k]) % MOD)


main()
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted17ms3128 KiB
subtask211/11
2Accepted28ms3128 KiB
3Accepted29ms3112 KiB
4Accepted165ms3200 KiB
5Accepted490ms3444 KiB
6Accepted17ms3140 KiB
7Accepted108ms3232 KiB
subtask30/13
8Accepted27ms3320 KiB
9Accepted30ms3128 KiB
10Accepted238ms3268 KiB
11Time limit exceeded2.086s14592 KiB
12Time limit exceeded2.095s27572 KiB
13Time limit exceeded2.092s27752 KiB
subtask40/19
14Time limit exceeded2.072s22852 KiB
15Time limit exceeded2.072s25140 KiB
16Time limit exceeded2.069s27784 KiB
17Time limit exceeded2.072s27736 KiB
18Time limit exceeded2.084s27724 KiB
subtask50/25
19Time limit exceeded2.084s9412 KiB
20Time limit exceeded2.081s8700 KiB
21Time limit exceeded2.085s8712 KiB
22Time limit exceeded2.085s9236 KiB
23Time limit exceeded2.071s6280 KiB
subtask60/32
24Time limit exceeded2.073s27720 KiB
25Time limit exceeded2.073s27736 KiB
26Time limit exceeded2.075s22852 KiB
27Time limit exceeded2.073s25292 KiB
28Time limit exceeded2.088s27792 KiB
29Time limit exceeded2.088s27472 KiB
30Time limit exceeded2.088s25356 KiB