105062024-04-03 16:47:57MagyarKendeSZLGVásárlások inflációs hatása (75 pont)cpp17Wrong answer 3/754ms3356 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    cin.tie(0), ios::sync_with_stdio(0);

    int N, K;
    cin >> N >> K;
    vector<ll> v(N);
    for (ll& x : v) cin >> x;

    priority_queue<ll, vector<ll>, greater<ll>> pq(v.begin(), v.end());

    ll result = 0;

    while (!pq.empty()) {
        ll x = pq.top();
        pq.pop();
        result += x;
        vector<ll> incr;
        for (int i = 0; !pq.empty() && i < K; i++) {
            incr.push_back(pq.top() + x);
            pq.pop();
        }
        for (ll y : incr) {
            pq.push(y);
        }
    }

    cout << result;
}
SubtaskSumTestVerdictTimeMemory
base3/75
1Accepted0/03ms1696 KiB
2Wrong answer0/04ms2032 KiB
3Accepted1/13ms2108 KiB
4Accepted1/13ms2300 KiB
5Accepted1/13ms2432 KiB
6Wrong answer0/12ms2520 KiB
7Wrong answer0/12ms2668 KiB
8Wrong answer0/12ms2600 KiB
9Wrong answer0/13ms2832 KiB
10Wrong answer0/13ms2920 KiB
11Wrong answer0/22ms2976 KiB
12Wrong answer0/53ms3100 KiB
13Wrong answer0/53ms3108 KiB
14Wrong answer0/53ms3244 KiB
15Wrong answer0/53ms3236 KiB
16Wrong answer0/54ms3340 KiB
17Wrong answer0/54ms3252 KiB
18Wrong answer0/54ms3256 KiB
19Wrong answer0/54ms3256 KiB
20Wrong answer0/54ms3256 KiB
21Wrong answer0/54ms3256 KiB
22Wrong answer0/54ms3252 KiB
23Wrong answer0/54ms3340 KiB
24Wrong answer0/54ms3356 KiB