114612024-09-29 16:50:28bzyPontos Átlagcpp17Wrong answer 60/10094ms1400 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int n, k; cin >> n >> k;
    int 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;
        int current = n-1;
        while(sum > k*n){
            sum -= P[current] - 1;
            current--;
            ans++;
        }
        cout << ans << "\n";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms360 KiB
2Accepted2ms360 KiB
subtask220/20
3Accepted2ms360 KiB
4Accepted2ms364 KiB
5Accepted3ms400 KiB
6Accepted3ms424 KiB
7Accepted2ms232 KiB
8Accepted2ms360 KiB
9Accepted2ms504 KiB
10Accepted3ms504 KiB
11Accepted2ms360 KiB
12Accepted2ms360 KiB
13Accepted3ms384 KiB
subtask340/40
14Accepted3ms504 KiB
15Accepted3ms384 KiB
16Accepted3ms504 KiB
17Accepted3ms500 KiB
18Accepted3ms360 KiB
19Accepted3ms360 KiB
20Accepted3ms488 KiB
21Accepted3ms384 KiB
22Accepted3ms504 KiB
23Accepted3ms404 KiB
24Accepted3ms496 KiB
25Accepted3ms232 KiB
26Accepted3ms232 KiB
subtask40/40
27Wrong answer94ms1176 KiB
28Partially correct94ms1196 KiB
29Wrong answer74ms1144 KiB
30Partially correct94ms1132 KiB
31Partially correct94ms1272 KiB
32Partially correct94ms1128 KiB
33Wrong answer74ms1272 KiB
34Partially correct94ms1388 KiB
35Partially correct94ms1132 KiB
36Wrong answer81ms1128 KiB
37Accepted74ms1268 KiB
38Accepted43ms1128 KiB
39Accepted90ms1256 KiB
40Accepted93ms1000 KiB
41Accepted68ms1128 KiB
42Accepted93ms1400 KiB
43Accepted65ms1128 KiB