114622024-09-29 16:54:09bzyPontos Átlagcpp17Runtime error 60/10094ms1400 KiB
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, k; cin >> n >> k;
    long long 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(),greater<>());
        int ans = 0;
        int current = 0;
        while(sum > k*n){
            sum -= P[current] - 1;
            current++;
            ans++;
        }
        cout << ans << "\n";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms360 KiB
2Accepted3ms360 KiB
subtask220/20
3Accepted2ms360 KiB
4Accepted3ms360 KiB
5Accepted3ms360 KiB
6Accepted2ms372 KiB
7Accepted2ms360 KiB
8Accepted3ms360 KiB
9Accepted2ms408 KiB
10Accepted3ms504 KiB
11Accepted2ms400 KiB
12Accepted2ms232 KiB
13Accepted2ms360 KiB
subtask340/40
14Accepted3ms368 KiB
15Accepted3ms448 KiB
16Accepted3ms632 KiB
17Accepted3ms360 KiB
18Accepted3ms232 KiB
19Accepted3ms384 KiB
20Accepted3ms488 KiB
21Accepted3ms376 KiB
22Accepted3ms504 KiB
23Accepted3ms360 KiB
24Accepted3ms632 KiB
25Accepted3ms488 KiB
26Accepted3ms504 KiB
subtask40/40
27Runtime error93ms1308 KiB
28Runtime error93ms1256 KiB
29Partially correct93ms1128 KiB
30Runtime error93ms1208 KiB
31Runtime error93ms1392 KiB
32Runtime error93ms1256 KiB
33Partially correct93ms1256 KiB
34Runtime error93ms1128 KiB
35Runtime error94ms1400 KiB
36Accepted82ms1260 KiB
37Wrong answer93ms1128 KiB
38Accepted41ms1128 KiB
39Runtime error90ms1060 KiB
40Runtime error92ms1256 KiB
41Runtime error68ms1256 KiB
42Runtime error92ms1256 KiB
43Accepted61ms1000 KiB