11462 | 2024-09-29 16:54:09 | bzy | Pontos Átlag | cpp17 | Runtime error 60/100 | 94ms | 1400 KiB |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, k; cin >> n >> k;
long long 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(),greater<>());
int ans = 0;
int current = 0;
while(sum > k*n){
sum -= P[current] - 1;
current++;
ans++;
}
cout << ans << "\n";
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 360 KiB | ||||
2 | Accepted | 3ms | 360 KiB | ||||
subtask2 | 20/20 | ||||||
3 | Accepted | 2ms | 360 KiB | ||||
4 | Accepted | 3ms | 360 KiB | ||||
5 | Accepted | 3ms | 360 KiB | ||||
6 | Accepted | 2ms | 372 KiB | ||||
7 | Accepted | 2ms | 360 KiB | ||||
8 | Accepted | 3ms | 360 KiB | ||||
9 | Accepted | 2ms | 408 KiB | ||||
10 | Accepted | 3ms | 504 KiB | ||||
11 | Accepted | 2ms | 400 KiB | ||||
12 | Accepted | 2ms | 232 KiB | ||||
13 | Accepted | 2ms | 360 KiB | ||||
subtask3 | 40/40 | ||||||
14 | Accepted | 3ms | 368 KiB | ||||
15 | Accepted | 3ms | 448 KiB | ||||
16 | Accepted | 3ms | 632 KiB | ||||
17 | Accepted | 3ms | 360 KiB | ||||
18 | Accepted | 3ms | 232 KiB | ||||
19 | Accepted | 3ms | 384 KiB | ||||
20 | Accepted | 3ms | 488 KiB | ||||
21 | Accepted | 3ms | 376 KiB | ||||
22 | Accepted | 3ms | 504 KiB | ||||
23 | Accepted | 3ms | 360 KiB | ||||
24 | Accepted | 3ms | 632 KiB | ||||
25 | Accepted | 3ms | 488 KiB | ||||
26 | Accepted | 3ms | 504 KiB | ||||
subtask4 | 0/40 | ||||||
27 | Runtime error | 93ms | 1308 KiB | ||||
28 | Runtime error | 93ms | 1256 KiB | ||||
29 | Partially correct | 93ms | 1128 KiB | ||||
30 | Runtime error | 93ms | 1208 KiB | ||||
31 | Runtime error | 93ms | 1392 KiB | ||||
32 | Runtime error | 93ms | 1256 KiB | ||||
33 | Partially correct | 93ms | 1256 KiB | ||||
34 | Runtime error | 93ms | 1128 KiB | ||||
35 | Runtime error | 94ms | 1400 KiB | ||||
36 | Accepted | 82ms | 1260 KiB | ||||
37 | Wrong answer | 93ms | 1128 KiB | ||||
38 | Accepted | 41ms | 1128 KiB | ||||
39 | Runtime error | 90ms | 1060 KiB | ||||
40 | Runtime error | 92ms | 1256 KiB | ||||
41 | Runtime error | 68ms | 1256 KiB | ||||
42 | Runtime error | 92ms | 1256 KiB | ||||
43 | Accepted | 61ms | 1000 KiB |