9112 | 2024-02-14 16:28:43 | 111 | Pontos Átlag | cpp17 | Accepted 100/100 | 52ms | 8408 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int, int>
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
#ifdef CB
freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
#endif
int N, K;
cin >> N >> K;
deque<int> v(N);
int s = 0;
for (int i = 0; i < N; i++) {
cin >> v[i];
s += v[i];
}
if (s < N * K) {
cout << 1 << '\n';
return 0;
}
sort(v.begin(), v.end());
int ans = 0;
while (s > N * K) {
s -= v.back() - 1;
v.pop_back();
ans++;
}
cout << ans << '\n';
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1828 KiB | ||||
2 | Accepted | 3ms | 2064 KiB | ||||
subtask2 | 20/20 | ||||||
3 | Accepted | 3ms | 2272 KiB | ||||
4 | Accepted | 2ms | 2356 KiB | ||||
5 | Accepted | 3ms | 2444 KiB | ||||
6 | Accepted | 3ms | 2656 KiB | ||||
7 | Accepted | 3ms | 2868 KiB | ||||
8 | Accepted | 2ms | 2948 KiB | ||||
9 | Accepted | 3ms | 3080 KiB | ||||
10 | Accepted | 3ms | 3288 KiB | ||||
11 | Accepted | 2ms | 3380 KiB | ||||
12 | Accepted | 3ms | 3500 KiB | ||||
13 | Accepted | 2ms | 3496 KiB | ||||
subtask3 | 40/40 | ||||||
14 | Accepted | 3ms | 3404 KiB | ||||
15 | Accepted | 3ms | 3524 KiB | ||||
16 | Accepted | 3ms | 3600 KiB | ||||
17 | Accepted | 3ms | 3600 KiB | ||||
18 | Accepted | 3ms | 3600 KiB | ||||
19 | Accepted | 3ms | 3596 KiB | ||||
20 | Accepted | 3ms | 3752 KiB | ||||
21 | Accepted | 3ms | 3704 KiB | ||||
22 | Accepted | 3ms | 3836 KiB | ||||
23 | Accepted | 3ms | 3712 KiB | ||||
24 | Accepted | 3ms | 3596 KiB | ||||
25 | Accepted | 3ms | 3600 KiB | ||||
26 | Accepted | 3ms | 3688 KiB | ||||
subtask4 | 40/40 | ||||||
27 | Accepted | 27ms | 6604 KiB | ||||
28 | Accepted | 50ms | 6888 KiB | ||||
29 | Accepted | 50ms | 7016 KiB | ||||
30 | Accepted | 50ms | 6760 KiB | ||||
31 | Accepted | 52ms | 7020 KiB | ||||
32 | Accepted | 50ms | 7420 KiB | ||||
33 | Accepted | 52ms | 7396 KiB | ||||
34 | Accepted | 52ms | 7592 KiB | ||||
35 | Accepted | 50ms | 7676 KiB | ||||
36 | Accepted | 35ms | 7800 KiB | ||||
37 | Accepted | 50ms | 7472 KiB | ||||
38 | Accepted | 26ms | 8012 KiB | ||||
39 | Accepted | 50ms | 8160 KiB | ||||
40 | Accepted | 48ms | 8288 KiB | ||||
41 | Accepted | 39ms | 8288 KiB | ||||
42 | Accepted | 48ms | 8288 KiB | ||||
43 | Accepted | 37ms | 8408 KiB |