114582024-09-29 16:35:49bzyPontos Átlagcpp17Wrong answer 60/10093ms1300 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;
        int dif = 0;
        for(int i = n-1; i >= 0; i--){
            dif += P[i] - 1;
            ans++;
            if(sum - dif <= k*n) break;
        }
        cout << ans << "\n";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted2ms504 KiB
2Accepted2ms360 KiB
subtask220/20
3Accepted3ms232 KiB
4Accepted2ms360 KiB
5Accepted3ms360 KiB
6Accepted3ms360 KiB
7Accepted2ms360 KiB
8Accepted3ms364 KiB
9Accepted2ms360 KiB
10Accepted3ms504 KiB
11Accepted2ms384 KiB
12Accepted2ms232 KiB
13Accepted2ms504 KiB
subtask340/40
14Accepted3ms444 KiB
15Accepted3ms624 KiB
16Accepted3ms292 KiB
17Accepted3ms488 KiB
18Accepted4ms360 KiB
19Accepted3ms504 KiB
20Accepted3ms232 KiB
21Accepted3ms384 KiB
22Accepted3ms384 KiB
23Accepted3ms232 KiB
24Accepted3ms504 KiB
25Accepted3ms360 KiB
26Accepted3ms256 KiB
subtask40/40
27Wrong answer93ms1120 KiB
28Partially correct93ms1128 KiB
29Partially correct93ms1212 KiB
30Partially correct92ms1004 KiB
31Partially correct92ms1128 KiB
32Partially correct93ms1128 KiB
33Partially correct93ms1132 KiB
34Partially correct93ms1268 KiB
35Partially correct93ms1128 KiB
36Accepted82ms1128 KiB
37Wrong answer93ms1300 KiB
38Accepted43ms1128 KiB
39Partially correct90ms1128 KiB
40Wrong answer90ms1128 KiB
41Partially correct68ms1128 KiB
42Wrong answer92ms1128 KiB
43Accepted63ms1128 KiB