98472024-03-11 20:51:08birozsMaximális szorzat (50 pont)python3Wrong answer 38/50275ms37760 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
for i in range(b,n):
    szorzat = (szorzat * lista[i]) % (10**9+7)
if szorzat >= 0:
    print(szorzat)
else:
    print(-1)

        

SubtaskSumTestVerdictTimeMemory
base38/50
1Accepted0/017ms11276 KiB
2Accepted0/017ms11344 KiB
3Accepted0/017ms11668 KiB
4Accepted0/017ms11976 KiB
5Accepted0/029ms13896 KiB
6Accepted2/217ms12324 KiB
7Accepted2/217ms12456 KiB
8Accepted2/217ms12540 KiB
9Accepted2/218ms12644 KiB
10Accepted2/235ms15144 KiB
11Accepted2/2214ms34444 KiB
12Accepted1/1232ms34988 KiB
13Accepted1/135ms13040 KiB
14Accepted1/152ms15324 KiB
15Wrong answer0/1173ms25200 KiB
16Accepted1/1179ms24892 KiB
17Wrong answer0/1172ms24948 KiB
18Accepted1/137ms15288 KiB
19Runtime error0/1112ms36564 KiB
20Runtime error0/1101ms35856 KiB
21Runtime error0/1120ms35592 KiB
22Runtime error0/178ms30084 KiB
23Accepted1/1240ms35960 KiB
24Accepted1/1238ms36060 KiB
25Accepted2/232ms14060 KiB
26Accepted2/232ms16344 KiB
27Runtime error0/267ms25128 KiB
28Runtime error0/165ms25096 KiB
29Wrong answer0/2175ms25752 KiB
30Accepted1/1275ms36788 KiB
31Wrong answer0/1100ms37760 KiB
32Accepted2/2168ms14596 KiB
33Accepted2/2263ms36824 KiB
34Accepted1/1241ms36932 KiB
35Accepted2/2261ms36696 KiB
36Accepted2/2275ms36852 KiB
37Accepted2/2263ms36920 KiB
38Accepted2/2263ms36964 KiB
39Accepted1/1158ms14456 KiB