134072025-01-07 20:41:28Vkrisztian01Maximális szorzat (50 pont)cpp17Wrong answer 5/5052ms1552 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)
    {
        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/01ms512 KiB
2Wrong answer0/01ms316 KiB
3Wrong answer0/01ms316 KiB
4Wrong answer0/01ms316 KiB
5Wrong answer0/04ms524 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/21ms316 KiB
10Wrong answer0/24ms512 KiB
11Wrong answer0/248ms1416 KiB
12Wrong answer0/148ms1408 KiB
13Wrong answer0/11ms316 KiB
14Wrong answer0/14ms564 KiB
15Accepted1/117ms848 KiB
16Wrong answer0/118ms1020 KiB
17Accepted1/117ms944 KiB
18Wrong answer0/19ms948 KiB
19Wrong answer0/135ms1448 KiB
20Wrong answer0/127ms1452 KiB
21Wrong answer0/152ms1460 KiB
22Wrong answer0/123ms1428 KiB
23Wrong answer0/152ms1264 KiB
24Wrong answer0/148ms1452 KiB
25Wrong answer0/21ms316 KiB
26Wrong answer0/24ms564 KiB
27Wrong answer0/226ms1048 KiB
28Wrong answer0/126ms932 KiB
29Accepted2/219ms944 KiB
30Wrong answer0/152ms1452 KiB
31Accepted1/135ms1452 KiB
32Wrong answer0/21ms316 KiB
33Wrong answer0/252ms1496 KiB
34Wrong answer0/152ms1504 KiB
35Wrong answer0/252ms1428 KiB
36Wrong answer0/252ms1452 KiB
37Wrong answer0/252ms1552 KiB
38Wrong answer0/252ms1448 KiB
39Wrong answer0/11ms316 KiB