105072024-04-03 17:07:12MagyarKendeSZLGVásárlások inflációs hatása (75 pont)cpp17Accepted 75/753ms4212 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;

    sort(v.begin(), v.end());

    ll result = 0;

    for (int i = 0; i < N; i++) {
        for (int j = max(i + 1, N - K); j < N; j++) {
            v[j] += v[i];
        }
        result += v[i];
    }

    cout << result;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1828 KiB
2Accepted0/03ms2064 KiB
3Accepted1/13ms2260 KiB
4Accepted1/12ms2348 KiB
5Accepted1/13ms2440 KiB
6Accepted1/13ms2644 KiB
7Accepted1/12ms2728 KiB
8Accepted1/13ms2856 KiB
9Accepted1/13ms3068 KiB
10Accepted1/12ms3152 KiB
11Accepted2/23ms3308 KiB
12Accepted5/52ms3180 KiB
13Accepted5/52ms3184 KiB
14Accepted5/53ms3148 KiB
15Accepted5/53ms3276 KiB
16Accepted5/53ms3368 KiB
17Accepted5/53ms3728 KiB
18Accepted5/53ms3820 KiB
19Accepted5/53ms3824 KiB
20Accepted5/53ms3804 KiB
21Accepted5/53ms3800 KiB
22Accepted5/53ms4024 KiB
23Accepted5/53ms4140 KiB
24Accepted5/53ms4212 KiB