109942024-05-04 17:01:23radocziaronMaximális szorzat (50 pont)python3Runtime error 3/50598ms14728 KiB
n,k,b = map(int,input().split())
lista = list(map(int,input().split()))
i = b
lista.sort()

while i != n and lista[i] <= 0 and k > 0:
    k = k - (-1*lista[i]+1)
    lista[i] += -1*lista[i]+1
    i += 1

i = 0
while i != n and lista[i] < 0:
    i+= 1
if i < b: 
    print(-1) 
else:
    i = b
    c = 1
    if k < 1:
        for i in range(n):
            c = c*lista[i]
    else:
        while k > 0:
            lista[i] += 1
            k -= 1
            if i+1 == n:
                i = b
            else:
                i += 1
        for i in range(n):
            c = c*lista[i]

    print(c)
SubtaskSumTestVerdictTimeMemory
base3/50
1Accepted0/017ms3044 KiB
2Accepted0/017ms3192 KiB
3Accepted0/017ms3192 KiB
4Accepted0/018ms3320 KiB
5Runtime error0/041ms3940 KiB
6Wrong answer0/217ms3044 KiB
7Wrong answer0/217ms3044 KiB
8Wrong answer0/217ms3044 KiB
9Wrong answer0/218ms3172 KiB
10Runtime error0/272ms4344 KiB
11Time limit exceeded0/2598ms13984 KiB
12Time limit exceeded0/1597ms13956 KiB
13Wrong answer0/121ms3172 KiB
14Runtime error0/172ms4196 KiB
15Wrong answer0/1234ms8940 KiB
16Time limit exceeded0/1595ms8940 KiB
17Time limit exceeded0/1595ms8868 KiB
18Accepted1/135ms3980 KiB
19Runtime error0/1101ms14728 KiB
20Runtime error0/190ms14308 KiB
21Runtime error0/1105ms13928 KiB
22Runtime error0/176ms11228 KiB
23Time limit exceeded0/1596ms14316 KiB
24Time limit exceeded0/1597ms13952 KiB
25Wrong answer0/230ms3044 KiB
26Runtime error0/267ms4196 KiB
27Runtime error0/261ms8476 KiB
28Runtime error0/161ms8520 KiB
29Accepted2/257ms8840 KiB
30Time limit exceeded0/1595ms14412 KiB
31Wrong answer0/1100ms14644 KiB
32Wrong answer0/2100ms3176 KiB
33Time limit exceeded0/2597ms14540 KiB
34Time limit exceeded0/1598ms14264 KiB
35Time limit exceeded0/2596ms14408 KiB
36Time limit exceeded0/2597ms14436 KiB
37Time limit exceeded0/2597ms14264 KiB
38Time limit exceeded0/2598ms14264 KiB
39Wrong answer0/198ms3084 KiB