114562024-09-29 16:05:42bzyPontos Átlagcpp17Wrong answer 60/10093ms1272 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{
        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
2Accepted2ms396 KiB
subtask220/20
3Accepted3ms360 KiB
4Accepted2ms232 KiB
5Accepted2ms360 KiB
6Accepted2ms360 KiB
7Accepted3ms264 KiB
8Accepted2ms384 KiB
9Accepted2ms360 KiB
10Accepted2ms256 KiB
11Accepted2ms384 KiB
12Accepted2ms232 KiB
13Accepted2ms504 KiB
subtask340/40
14Accepted3ms360 KiB
15Accepted3ms384 KiB
16Accepted3ms504 KiB
17Accepted3ms504 KiB
18Accepted3ms232 KiB
19Accepted3ms504 KiB
20Accepted3ms488 KiB
21Accepted3ms376 KiB
22Accepted3ms360 KiB
23Accepted3ms256 KiB
24Accepted3ms504 KiB
25Accepted3ms376 KiB
26Accepted3ms232 KiB
subtask40/40
27Wrong answer93ms1128 KiB
28Partially correct93ms1204 KiB
29Wrong answer92ms1272 KiB
30Partially correct92ms1176 KiB
31Wrong answer93ms1128 KiB
32Partially correct92ms1044 KiB
33Wrong answer93ms1272 KiB
34Wrong answer93ms1028 KiB
35Partially correct93ms1128 KiB
36Wrong answer82ms1272 KiB
37Wrong answer92ms1128 KiB
38Accepted45ms1128 KiB
39Accepted89ms1128 KiB
40Accepted90ms1128 KiB
41Accepted68ms1184 KiB
42Accepted90ms1036 KiB
43Accepted63ms1000 KiB