11464 | 2024-09-29 16:59:49 | bzy | Pontos Átlag | cpp17 | Accepted 100/100 | 93ms | 1272 KiB |
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n, k; cin >> n >> k;
long long sum = 0;
vector <int> P(n);
long long sum2 = n*k;
for(int i = 0; i < n; i++){
cin >> P[i];
sum += P[i];
}
if(sum2 == sum) cout << 0 << "\n";
else if(sum2 > sum) cout << 1 << "\n";
else{
sort(P.begin(),P.end(),greater<>());
int ans = 0;
int current = 0;
while(sum > sum2){
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 | 2ms | 504 KiB | ||||
subtask2 | 20/20 | ||||||
3 | Accepted | 3ms | 384 KiB | ||||
4 | Accepted | 3ms | 384 KiB | ||||
5 | Accepted | 2ms | 360 KiB | ||||
6 | Accepted | 3ms | 384 KiB | ||||
7 | Accepted | 2ms | 364 KiB | ||||
8 | Accepted | 3ms | 232 KiB | ||||
9 | Accepted | 3ms | 360 KiB | ||||
10 | Accepted | 2ms | 360 KiB | ||||
11 | Accepted | 2ms | 384 KiB | ||||
12 | Accepted | 2ms | 376 KiB | ||||
13 | Accepted | 2ms | 232 KiB | ||||
subtask3 | 40/40 | ||||||
14 | Accepted | 4ms | 360 KiB | ||||
15 | Accepted | 3ms | 376 KiB | ||||
16 | Accepted | 3ms | 488 KiB | ||||
17 | Accepted | 4ms | 384 KiB | ||||
18 | Accepted | 3ms | 360 KiB | ||||
19 | Accepted | 3ms | 360 KiB | ||||
20 | Accepted | 3ms | 496 KiB | ||||
21 | Accepted | 3ms | 368 KiB | ||||
22 | Accepted | 3ms | 360 KiB | ||||
23 | Accepted | 3ms | 360 KiB | ||||
24 | Accepted | 3ms | 632 KiB | ||||
25 | Accepted | 3ms | 384 KiB | ||||
26 | Accepted | 3ms | 360 KiB | ||||
subtask4 | 40/40 | ||||||
27 | Accepted | 74ms | 1128 KiB | ||||
28 | Accepted | 93ms | 1144 KiB | ||||
29 | Accepted | 93ms | 1268 KiB | ||||
30 | Accepted | 93ms | 1144 KiB | ||||
31 | Accepted | 93ms | 1128 KiB | ||||
32 | Accepted | 93ms | 1128 KiB | ||||
33 | Accepted | 93ms | 1128 KiB | ||||
34 | Accepted | 93ms | 1272 KiB | ||||
35 | Accepted | 93ms | 1128 KiB | ||||
36 | Accepted | 83ms | 1180 KiB | ||||
37 | Accepted | 74ms | 1128 KiB | ||||
38 | Accepted | 43ms | 1128 KiB | ||||
39 | Accepted | 90ms | 1168 KiB | ||||
40 | Accepted | 92ms | 1256 KiB | ||||
41 | Accepted | 68ms | 1128 KiB | ||||
42 | Accepted | 92ms | 1128 KiB | ||||
43 | Accepted | 63ms | 1128 KiB |