114572024-09-29 16:10:14bzyPontos Átlagcpp17Wrong answer 60/10093ms1332 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int n, k; cin >> n >> k;
    ll sum = 0;
    int P[n]; for(int &p : P) cin >> p, sum += p;
    if(k*n == sum) cout << 0 << "\n";
    else if(k*n > sum) cout << 1 << "\n";
    else{
        sort(P,P+n);
        int ans = 0;
        for(int i = n-1; i >= 0; i--){
            sum -= P[i];
            sum++;
            ans++;
            if(sum <= k*n) break;
        }
        cout << ans << "\n";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted2ms400 KiB
2Accepted2ms360 KiB
subtask220/20
3Accepted3ms360 KiB
4Accepted2ms384 KiB
5Accepted3ms420 KiB
6Accepted3ms384 KiB
7Accepted3ms504 KiB
8Accepted3ms360 KiB
9Accepted3ms504 KiB
10Accepted2ms376 KiB
11Accepted3ms256 KiB
12Accepted3ms232 KiB
13Accepted2ms488 KiB
subtask340/40
14Accepted3ms256 KiB
15Accepted3ms236 KiB
16Accepted3ms488 KiB
17Accepted3ms360 KiB
18Accepted4ms532 KiB
19Accepted4ms396 KiB
20Accepted3ms376 KiB
21Accepted3ms500 KiB
22Accepted3ms360 KiB
23Accepted3ms400 KiB
24Accepted3ms360 KiB
25Accepted3ms384 KiB
26Accepted3ms496 KiB
subtask40/40
27Wrong answer93ms932 KiB
28Partially correct93ms1132 KiB
29Partially correct93ms1128 KiB
30Partially correct93ms1332 KiB
31Partially correct93ms1188 KiB
32Partially correct93ms1128 KiB
33Partially correct93ms1128 KiB
34Partially correct93ms1128 KiB
35Partially correct93ms1268 KiB
36Accepted82ms1164 KiB
37Wrong answer93ms1180 KiB
38Accepted43ms1272 KiB
39Partially correct89ms1052 KiB
40Wrong answer90ms1196 KiB
41Partially correct68ms1164 KiB
42Wrong answer90ms1132 KiB
43Accepted63ms1128 KiB