155212025-02-20 10:39:48linhnkMaximális szorzat (50 pont)cpp17Wrong answer 3/5078ms1440 KiB
#include <iostream>
#include <bits/stdc++.h>
#include<queue>

using namespace std;

int main()
{
    int n, k, a, d=1, ne=0, b;
    cin>>n>>k>>b;
    priority_queue <int, vector<int>, greater<int>> kevin;
    vector<int> bence(b);
    for(int i=0; i<n; i++){
        cin>>a;
        kevin.push(a);
        if(a<0){
            ne++;
        }
    }
    if(ne<b){
        cout<<"-1";
        return 0;
    }
    for(int i=0; i<b; i++){
        bence[i]=kevin.top();
        kevin.pop();
        }
    for(int i=0; i<k; i++){
        kevin.push(kevin.top()+1);
        kevin.pop();
    }
    for(auto x:bence){
        d*=x%1000000007;
    }
    while(kevin.size()>0){
        d*=kevin.top()%1000000007;
        kevin.pop();
    }
    cout<<d;
}
SubtaskSumTestVerdictTimeMemory
base3/50
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Accepted0/01ms328 KiB
4Accepted0/01ms356 KiB
5Wrong answer0/06ms408 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/21ms508 KiB
9Wrong answer0/21ms316 KiB
10Wrong answer0/27ms460 KiB
11Wrong answer0/271ms896 KiB
12Wrong answer0/175ms1004 KiB
13Wrong answer0/12ms388 KiB
14Wrong answer0/18ms316 KiB
15Wrong answer0/143ms824 KiB
16Wrong answer0/143ms856 KiB
17Wrong answer0/139ms948 KiB
18Accepted1/112ms732 KiB
19Wrong answer0/150ms1300 KiB
20Wrong answer0/139ms1340 KiB
21Wrong answer0/167ms1220 KiB
22Wrong answer0/129ms1420 KiB
23Wrong answer0/178ms1096 KiB
24Wrong answer0/175ms928 KiB
25Wrong answer0/21ms316 KiB
26Wrong answer0/26ms316 KiB
27Wrong answer0/234ms852 KiB
28Wrong answer0/134ms820 KiB
29Accepted2/219ms888 KiB
30Wrong answer0/167ms1440 KiB
31Wrong answer0/150ms1040 KiB
32Wrong answer0/22ms412 KiB
33Wrong answer0/267ms1304 KiB
34Wrong answer0/168ms1384 KiB
35Wrong answer0/271ms1200 KiB
36Wrong answer0/265ms1196 KiB
37Wrong answer0/267ms1436 KiB
38Wrong answer0/267ms1388 KiB
39Wrong answer0/12ms316 KiB