114552024-09-29 12:26:27bzyPontos Átlagcpp17Wrong answer 60/10097ms1400 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n, k; cin >> n >> k;
    int 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{
        int goal = sum - k*n;
        sort(P,P+n);
        int dif = 0;
        int ans = 0;
        for(int i = n-1; i >= 0; i--){
            dif += P[i] - 1;
            ans ++;
            if(dif >= goal) break;
        }
        cout << ans << "\n";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms360 KiB
2Accepted3ms360 KiB
subtask220/20
3Accepted3ms424 KiB
4Accepted3ms524 KiB
5Accepted3ms360 KiB
6Accepted3ms384 KiB
7Accepted3ms360 KiB
8Accepted3ms360 KiB
9Accepted3ms512 KiB
10Accepted3ms384 KiB
11Accepted3ms364 KiB
12Accepted3ms384 KiB
13Accepted3ms500 KiB
subtask340/40
14Accepted3ms420 KiB
15Accepted3ms296 KiB
16Accepted3ms632 KiB
17Accepted3ms360 KiB
18Accepted3ms380 KiB
19Accepted4ms384 KiB
20Accepted3ms480 KiB
21Accepted3ms360 KiB
22Accepted3ms360 KiB
23Accepted3ms256 KiB
24Accepted3ms360 KiB
25Accepted3ms632 KiB
26Accepted3ms504 KiB
subtask40/40
27Wrong answer93ms1144 KiB
28Partially correct93ms1180 KiB
29Wrong answer71ms1168 KiB
30Partially correct93ms1128 KiB
31Wrong answer97ms1128 KiB
32Partially correct93ms1128 KiB
33Wrong answer71ms1400 KiB
34Wrong answer93ms1128 KiB
35Partially correct93ms1132 KiB
36Wrong answer78ms1188 KiB
37Accepted70ms1128 KiB
38Accepted43ms996 KiB
39Accepted89ms1128 KiB
40Accepted90ms1128 KiB
41Accepted68ms1128 KiB
42Accepted90ms1172 KiB
43Accepted63ms1128 KiB