11459 | 2024-09-29 16:43:51 | bzy | Pontos Átlag | cpp17 | Wrong answer 60/100 | 92ms | 1656 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;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 2ms | 360 KiB | ||||
2 | Accepted | 2ms | 360 KiB | ||||
subtask2 | 20/20 | ||||||
3 | Accepted | 2ms | 360 KiB | ||||
4 | Accepted | 3ms | 360 KiB | ||||
5 | Accepted | 3ms | 256 KiB | ||||
6 | Accepted | 2ms | 360 KiB | ||||
7 | Accepted | 2ms | 232 KiB | ||||
8 | Accepted | 3ms | 504 KiB | ||||
9 | Accepted | 3ms | 204 KiB | ||||
10 | Accepted | 2ms | 360 KiB | ||||
11 | Accepted | 2ms | 380 KiB | ||||
12 | Accepted | 3ms | 384 KiB | ||||
13 | Accepted | 12ms | 400 KiB | ||||
subtask3 | 40/40 | ||||||
14 | Accepted | 3ms | 500 KiB | ||||
15 | Accepted | 3ms | 400 KiB | ||||
16 | Accepted | 3ms | 384 KiB | ||||
17 | Accepted | 3ms | 448 KiB | ||||
18 | Accepted | 3ms | 364 KiB | ||||
19 | Accepted | 3ms | 360 KiB | ||||
20 | Accepted | 3ms | 296 KiB | ||||
21 | Accepted | 3ms | 376 KiB | ||||
22 | Accepted | 3ms | 488 KiB | ||||
23 | Accepted | 3ms | 360 KiB | ||||
24 | Accepted | 3ms | 360 KiB | ||||
25 | Accepted | 3ms | 360 KiB | ||||
26 | Accepted | 3ms | 496 KiB | ||||
subtask4 | 0/40 | ||||||
27 | Wrong answer | 92ms | 1220 KiB | ||||
28 | Partially correct | 92ms | 1396 KiB | ||||
29 | Partially correct | 92ms | 1272 KiB | ||||
30 | Partially correct | 92ms | 1056 KiB | ||||
31 | Partially correct | 92ms | 1216 KiB | ||||
32 | Partially correct | 92ms | 1656 KiB | ||||
33 | Partially correct | 92ms | 1128 KiB | ||||
34 | Partially correct | 92ms | 1128 KiB | ||||
35 | Partially correct | 92ms | 1068 KiB | ||||
36 | Accepted | 82ms | 1208 KiB | ||||
37 | Wrong answer | 92ms | 1308 KiB | ||||
38 | Accepted | 41ms | 1304 KiB | ||||
39 | Partially correct | 87ms | 1216 KiB | ||||
40 | Wrong answer | 90ms | 1128 KiB | ||||
41 | Partially correct | 67ms | 1528 KiB | ||||
42 | Wrong answer | 90ms | 1168 KiB | ||||
43 | Accepted | 61ms | 1272 KiB |