114282024-09-15 14:24:24CsongiPontos Átlagcpp17Wrong answer 0/10045ms1400 KiB
#include <bits/stdc++.h>
using namespace std;

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

    long long int n, k, sum = 0;
    cin >> n >> k;
    vector<int> q(n);
    long long int sum2 = n*k;
    for (int i = 0; i < n; i++)
    {
        cin >> q[i];
        sum += q[i];
    }

    if (sum < sum2)
    {
        cout << 1 << endl;
        return 0;
    }
    sort(q.begin(), q.end());
    int ki = 0;
    while (sum > sum2)
    {
        sum -= q.back();
        sum--;
        q.pop_back(); ki++;
    }
    cout << ki << endl;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer3ms504 KiB
2Accepted3ms360 KiB
subtask20/20
3Accepted3ms540 KiB
4Accepted3ms440 KiB
5Accepted3ms492 KiB
6Accepted2ms508 KiB
7Accepted2ms504 KiB
8Accepted3ms500 KiB
9Accepted3ms360 KiB
10Accepted2ms360 KiB
11Wrong answer2ms376 KiB
12Wrong answer3ms500 KiB
13Accepted2ms360 KiB
subtask30/40
14Accepted3ms360 KiB
15Partially correct3ms548 KiB
16Accepted3ms488 KiB
17Accepted3ms400 KiB
18Accepted2ms504 KiB
19Accepted3ms360 KiB
20Accepted3ms360 KiB
21Accepted3ms360 KiB
22Accepted3ms500 KiB
23Wrong answer3ms232 KiB
24Accepted3ms504 KiB
25Wrong answer3ms376 KiB
26Accepted3ms376 KiB
subtask40/40
27Accepted25ms1400 KiB
28Partially correct45ms1128 KiB
29Accepted45ms1088 KiB
30Accepted43ms1272 KiB
31Accepted43ms1272 KiB
32Accepted45ms1144 KiB
33Partially correct43ms1128 KiB
34Partially correct43ms1164 KiB
35Partially correct45ms1236 KiB
36Accepted28ms1084 KiB
37Accepted45ms1144 KiB
38Accepted20ms1144 KiB
39Wrong answer43ms1272 KiB
40Accepted43ms1244 KiB
41Wrong answer34ms1256 KiB
42Accepted43ms1128 KiB
43Accepted30ms1272 KiB