98512024-03-11 23:50:5542Maximális szorzat (50 pont)python3Wrong answer 1/5057ms37296 KiB
# O(NlogN)
from sys import stdin, stdout
input=stdin.readline
mod=10**9+7

def solv():
    N,K,b = [int(x) for x in input().split()]
    A = [int(x) for x in input().split()]
    print(0)
    return
    #print(A,N,K,b)
    Aplus=[]
    Aminus=[]
    for a in A:
        if a<0:
            Aminus.append(a)
        else:
            Aplus.append(a)
    if len(Aminus)<b:
        print(-1)
        return
    Aminus.sort(reverse=True)
    #print(Aminus,K,b)
    for i in range(len(Aminus)-b):
        K+=Aminus[i]
    if K<0:
        print(-1)
        return
    prod=1
    for i in range(len(Aminus)-b,len(Aminus)):
        prod*=-Aminus[i]
        prod%=mod
    if len(Aplus)==0:
        if len(Aminus)==b:
            print(-1)
            return
    for i in range(len(Aminus)-b):
        Aplus.append(0)
    Aplus.sort()
    Aplus.append(10**10)
    i=0
    while K>0:
        if i==0:
            Aplus[0]+=1
            K-=1
            i+=1
        else:
            if Aplus[i-1]>Aplus[i]:
                Aplus[i]+=1
                K-=1
                i+=1
            else:
                i=0
    #print(K,Aplus,prod)
    for i in range(len(Aplus)-1):
        prod*=Aplus[i]
        prod%=mod
    print(prod)
    
solv()

SubtaskSumTestVerdictTimeMemory
base1/50
1Wrong answer0/017ms11360 KiB
2Wrong answer0/018ms11744 KiB
3Wrong answer0/017ms12112 KiB
4Wrong answer0/017ms12424 KiB
5Wrong answer0/021ms14396 KiB
6Wrong answer0/218ms12812 KiB
7Wrong answer0/217ms12536 KiB
8Wrong answer0/218ms12956 KiB
9Wrong answer0/218ms13176 KiB
10Wrong answer0/221ms15084 KiB
11Wrong answer0/254ms34596 KiB
12Wrong answer0/154ms35112 KiB
13Wrong answer0/117ms13728 KiB
14Wrong answer0/120ms15664 KiB
15Wrong answer0/135ms25096 KiB
16Wrong answer0/135ms25164 KiB
17Wrong answer0/134ms24952 KiB
18Accepted1/128ms15368 KiB
19Wrong answer0/150ms35508 KiB
20Wrong answer0/150ms36148 KiB
21Wrong answer0/152ms35892 KiB
22Wrong answer0/146ms29968 KiB
23Wrong answer0/157ms36168 KiB
24Wrong answer0/154ms36120 KiB
25Wrong answer0/218ms14316 KiB
26Wrong answer0/221ms16764 KiB
27Wrong answer0/237ms24952 KiB
28Wrong answer0/135ms24932 KiB
29Wrong answer0/235ms25848 KiB
30Wrong answer0/157ms36748 KiB
31Wrong answer0/154ms36400 KiB
32Wrong answer0/218ms14852 KiB
33Wrong answer0/257ms36972 KiB
34Wrong answer0/157ms36868 KiB
35Wrong answer0/257ms36960 KiB
36Wrong answer0/257ms36944 KiB
37Wrong answer0/254ms37208 KiB
38Wrong answer0/257ms37296 KiB
39Wrong answer0/118ms14836 KiB