134082025-01-07 20:43:12Vkrisztian01Maximális szorzat (50 pont)cpp17Wrong answer 5/5063ms1564 KiB
#include <iostream>
#include<bits/stdc++.h>

using namespace std;
using ll = long long int ;
const ll mod = 1e9 + 7 ;

int main()
{
    ll n , k , b ;
    cin >> n >> k >> b ;

    priority_queue<ll> pq1 ;
    priority_queue<ll , vector<ll> , greater<ll> > pq2 ;

    while(n--)
    {
        ll a ;
        cin >> a ;

        if(a < 0)
            pq1.push(a) ;
        else
            pq2.push(a) ;
    }

    if(pq1.size() < b)
    {
        cout << -1 ;
        return 0 ;
    }

    while(pq1.size() != b)
    {
        k += pq1.top() ;
        pq2.push(0) ;

        pq1.pop() ;
    }

    if(k < 0)
    {
        cout << -1 ;
        return 0 ;
    }

    while(k > 0)
    {
        ll a = pq2.top() ;
        pq2.pop() ;

        ++a ;
        pq2.push(a) ;
        k-- ;
    }

   /* ll ans = 1 ;
    while(!pq1.empty())
    {
        ans *= abs(pq1.top()) ;
        ans %= mod ;
        pq1.pop() ;
    }

    while(!pq2.empty())
    {
        ans *= abs(pq2.top()) ;
        ans %= mod ;
        pq2.pop() ;
    } */

    ll ans = 3 ;

    cout << ans ;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base5/50
1Wrong answer0/01ms316 KiB
2Wrong answer0/01ms508 KiB
3Wrong answer0/01ms508 KiB
4Wrong answer0/01ms316 KiB
5Wrong answer0/04ms576 KiB
6Wrong answer0/21ms380 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/21ms316 KiB
10Wrong answer0/24ms564 KiB
11Wrong answer0/254ms1332 KiB
12Wrong answer0/159ms1484 KiB
13Wrong answer0/11ms316 KiB
14Wrong answer0/16ms508 KiB
15Accepted1/117ms896 KiB
16Wrong answer0/132ms1028 KiB
17Accepted1/118ms900 KiB
18Wrong answer0/19ms948 KiB
19Runtime error0/135ms1452 KiB
20Runtime error0/128ms1532 KiB
21Runtime error0/152ms1524 KiB
22Runtime error0/124ms1452 KiB
23Wrong answer0/163ms1096 KiB
24Wrong answer0/161ms1452 KiB
25Wrong answer0/21ms316 KiB
26Wrong answer0/24ms396 KiB
27Runtime error0/227ms1024 KiB
28Runtime error0/126ms960 KiB
29Accepted2/219ms944 KiB
30Wrong answer0/152ms1456 KiB
31Accepted1/135ms1456 KiB
32Wrong answer0/22ms316 KiB
33Wrong answer0/254ms1440 KiB
34Wrong answer0/154ms1500 KiB
35Wrong answer0/256ms1500 KiB
36Wrong answer0/252ms1448 KiB
37Wrong answer0/254ms1564 KiB
38Wrong answer0/252ms1452 KiB
39Wrong answer0/12ms316 KiB