11429 | 2024-09-15 14:26:40 | Csongi | Pontos Átlag | cpp17 | Accepted 100/100 | 45ms | 1404 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
long long int n, k, sum = 0;
cin >> n >> k;
vector<int> q(n);
long long int sum2 = n*k;
for (int i = 0; i < n; i++)
{
cin >> q[i];
sum += q[i];
}
if (sum < sum2)
{
cout << 1 << endl;
return 0;
}
sort(q.begin(), q.end());
int ki = 0;
while (sum > sum2)
{
sum -= q.back() - 1;
q.pop_back(); ki++;
}
cout << ki << endl;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 504 KiB | ||||
2 | Accepted | 2ms | 360 KiB | ||||
subtask2 | 20/20 | ||||||
3 | Accepted | 3ms | 360 KiB | ||||
4 | Accepted | 3ms | 536 KiB | ||||
5 | Accepted | 3ms | 360 KiB | ||||
6 | Accepted | 3ms | 456 KiB | ||||
7 | Accepted | 2ms | 360 KiB | ||||
8 | Accepted | 3ms | 384 KiB | ||||
9 | Accepted | 3ms | 360 KiB | ||||
10 | Accepted | 3ms | 384 KiB | ||||
11 | Accepted | 3ms | 360 KiB | ||||
12 | Accepted | 3ms | 500 KiB | ||||
13 | Accepted | 3ms | 360 KiB | ||||
subtask3 | 40/40 | ||||||
14 | Accepted | 3ms | 504 KiB | ||||
15 | Accepted | 3ms | 504 KiB | ||||
16 | Accepted | 3ms | 420 KiB | ||||
17 | Accepted | 3ms | 400 KiB | ||||
18 | Accepted | 3ms | 240 KiB | ||||
19 | Accepted | 3ms | 232 KiB | ||||
20 | Accepted | 3ms | 504 KiB | ||||
21 | Accepted | 3ms | 360 KiB | ||||
22 | Accepted | 2ms | 504 KiB | ||||
23 | Accepted | 3ms | 504 KiB | ||||
24 | Accepted | 3ms | 504 KiB | ||||
25 | Accepted | 3ms | 496 KiB | ||||
26 | Accepted | 3ms | 360 KiB | ||||
subtask4 | 40/40 | ||||||
27 | Accepted | 25ms | 1144 KiB | ||||
28 | Accepted | 45ms | 1180 KiB | ||||
29 | Accepted | 43ms | 1128 KiB | ||||
30 | Accepted | 43ms | 1300 KiB | ||||
31 | Accepted | 43ms | 1272 KiB | ||||
32 | Accepted | 45ms | 1128 KiB | ||||
33 | Accepted | 45ms | 1400 KiB | ||||
34 | Accepted | 45ms | 1272 KiB | ||||
35 | Accepted | 43ms | 1404 KiB | ||||
36 | Accepted | 28ms | 1272 KiB | ||||
37 | Accepted | 45ms | 1128 KiB | ||||
38 | Accepted | 20ms | 1272 KiB | ||||
39 | Accepted | 43ms | 1272 KiB | ||||
40 | Accepted | 43ms | 1272 KiB | ||||
41 | Accepted | 34ms | 1128 KiB | ||||
42 | Accepted | 43ms | 1272 KiB | ||||
43 | Accepted | 32ms | 1128 KiB |