114602024-09-29 16:48:54bzyPontos Átlagcpp17Runtime error 60/10097ms1272 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int n, k; cin >> n >> k;
    ll sum = 0;
    vector <int> P(n); 
    for(int i = 0; i < n; i++){
        cin >> P[i];
        sum += P[i];
    }
    if(k*n == sum) cout << 0 << "\n";
    else if(k*n > sum) cout << 1 << "\n";
    else{
        sort(P.begin(),P.end());
        int ans = 0;
        int current = n-1;
        while(sum > k*n){
            sum -= P[current] - 1;
            current--;
            ans++;
        }
        cout << ans << "\n";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms508 KiB
2Accepted2ms360 KiB
subtask220/20
3Accepted2ms488 KiB
4Accepted3ms384 KiB
5Accepted2ms384 KiB
6Accepted3ms360 KiB
7Accepted2ms256 KiB
8Accepted3ms372 KiB
9Accepted3ms376 KiB
10Accepted3ms360 KiB
11Accepted3ms384 KiB
12Accepted2ms504 KiB
13Accepted2ms232 KiB
subtask340/40
14Accepted3ms360 KiB
15Accepted3ms668 KiB
16Accepted3ms400 KiB
17Accepted3ms412 KiB
18Accepted3ms360 KiB
19Accepted3ms376 KiB
20Accepted3ms376 KiB
21Accepted3ms488 KiB
22Accepted3ms504 KiB
23Accepted3ms232 KiB
24Accepted3ms504 KiB
25Accepted3ms632 KiB
26Accepted3ms384 KiB
subtask40/40
27Runtime error97ms1128 KiB
28Runtime error97ms1256 KiB
29Partially correct97ms1128 KiB
30Runtime error97ms1272 KiB
31Runtime error96ms1256 KiB
32Runtime error96ms1128 KiB
33Partially correct96ms1128 KiB
34Runtime error97ms1128 KiB
35Runtime error96ms1256 KiB
36Accepted86ms1128 KiB
37Wrong answer96ms1260 KiB
38Accepted43ms1128 KiB
39Runtime error93ms1216 KiB
40Runtime error94ms1260 KiB
41Runtime error71ms1128 KiB
42Runtime error94ms1128 KiB
43Accepted64ms1128 KiB