114592024-09-29 16:43:51bzyPontos Átlagcpp17Wrong answer 60/10092ms1656 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int n, k; cin >> n >> k;
    ll 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());
        int ans = 0;
        for(int i = n-1; i >= 0; i--){
            sum -= P[i] - 1;
            ans++;
            if(sum <= n*k) break;
        }
        cout << ans << "\n";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted2ms360 KiB
2Accepted2ms360 KiB
subtask220/20
3Accepted2ms360 KiB
4Accepted3ms360 KiB
5Accepted3ms256 KiB
6Accepted2ms360 KiB
7Accepted2ms232 KiB
8Accepted3ms504 KiB
9Accepted3ms204 KiB
10Accepted2ms360 KiB
11Accepted2ms380 KiB
12Accepted3ms384 KiB
13Accepted12ms400 KiB
subtask340/40
14Accepted3ms500 KiB
15Accepted3ms400 KiB
16Accepted3ms384 KiB
17Accepted3ms448 KiB
18Accepted3ms364 KiB
19Accepted3ms360 KiB
20Accepted3ms296 KiB
21Accepted3ms376 KiB
22Accepted3ms488 KiB
23Accepted3ms360 KiB
24Accepted3ms360 KiB
25Accepted3ms360 KiB
26Accepted3ms496 KiB
subtask40/40
27Wrong answer92ms1220 KiB
28Partially correct92ms1396 KiB
29Partially correct92ms1272 KiB
30Partially correct92ms1056 KiB
31Partially correct92ms1216 KiB
32Partially correct92ms1656 KiB
33Partially correct92ms1128 KiB
34Partially correct92ms1128 KiB
35Partially correct92ms1068 KiB
36Accepted82ms1208 KiB
37Wrong answer92ms1308 KiB
38Accepted41ms1304 KiB
39Partially correct87ms1216 KiB
40Wrong answer90ms1128 KiB
41Partially correct67ms1528 KiB
42Wrong answer90ms1168 KiB
43Accepted61ms1272 KiB