98482024-03-11 21:02:18birozsMaximális szorzat (50 pont)python3Runtime error 41/50264ms37144 KiB
N,K,b = map(int,input().split())
lista = list(map(int,input().split()))
lista.sort()
n = len(lista)
szorzat = 1
for i in range(b):
    szorzat = (szorzat * lista[i]) % (10**9+7)
while K > 0:
    j = b
    elso = lista[b]
    while j < n and lista[j] == elso and K > 0:
        lista[j] += 1
        K = K - 1
        j += 1
if lista[b] < 0:
    print(-1)
else:
    for i in range(b,n):
        szorzat = (szorzat * lista[i]) % (10**9+7)
    print(szorzat)

        

SubtaskSumTestVerdictTimeMemory
base41/50
1Accepted0/017ms11180 KiB
2Accepted0/017ms11496 KiB
3Accepted0/017ms11776 KiB
4Accepted0/017ms12176 KiB
5Accepted0/029ms13980 KiB
6Accepted2/217ms12196 KiB
7Accepted2/217ms12456 KiB
8Accepted2/218ms12448 KiB
9Accepted2/218ms12956 KiB
10Accepted2/237ms14932 KiB
11Accepted2/2215ms34480 KiB
12Accepted1/1229ms34872 KiB
13Accepted1/135ms13120 KiB
14Accepted1/152ms15284 KiB
15Accepted1/1166ms24964 KiB
16Accepted1/1165ms24628 KiB
17Accepted1/1171ms24744 KiB
18Accepted1/137ms15212 KiB
19Runtime error0/1111ms37004 KiB
20Runtime error0/1100ms36032 KiB
21Runtime error0/1119ms34996 KiB
22Runtime error0/176ms29660 KiB
23Accepted1/1237ms36024 KiB
24Accepted1/1250ms37012 KiB
25Accepted2/232ms13912 KiB
26Accepted2/230ms16192 KiB
27Runtime error0/268ms24944 KiB
28Runtime error0/167ms24940 KiB
29Wrong answer0/2186ms25752 KiB
30Accepted1/1264ms36388 KiB
31Accepted1/179ms37144 KiB
32Accepted2/2179ms14508 KiB
33Accepted2/2254ms36780 KiB
34Accepted1/1234ms36596 KiB
35Accepted2/2254ms36672 KiB
36Accepted2/2261ms36472 KiB
37Accepted2/2259ms36600 KiB
38Accepted2/2261ms36628 KiB
39Accepted1/1177ms14240 KiB