11624 | 2024-11-01 12:02:38 | MagyarKendeSZLG | Pontos Átlag | cpp17 | Accepted 100/100 | 43ms | 2040 KiB |
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
using ll = long long;
int main() {
cin.tie(0), ios::sync_with_stdio(0);
ll N, K;
cin >> N >> K;
vector<ll> p(N);
for (ll& x : p) cin >> x;
sort(p.rbegin(), p.rend());
ll avg = accumulate(p.begin(), p.end(), 0LL),
goal = K * N;
if (avg == goal) {
cout << "0\n";
exit(0);
}
if (avg < goal) {
cout << "1\n";
exit(0);
}
for (int i = 0; i < N; i++) {
avg -= p[i] - 1;
if (avg <= goal) {
cout << i + 1 << "\n";
exit(0);
}
}
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 1ms | 320 KiB | ||||
2 | Accepted | 1ms | 320 KiB | ||||
subtask2 | 20/20 | ||||||
3 | Accepted | 1ms | 320 KiB | ||||
4 | Accepted | 1ms | 320 KiB | ||||
5 | Accepted | 1ms | 320 KiB | ||||
6 | Accepted | 1ms | 508 KiB | ||||
7 | Accepted | 1ms | 320 KiB | ||||
8 | Accepted | 1ms | 320 KiB | ||||
9 | Accepted | 1ms | 508 KiB | ||||
10 | Accepted | 1ms | 320 KiB | ||||
11 | Accepted | 1ms | 320 KiB | ||||
12 | Accepted | 1ms | 320 KiB | ||||
13 | Accepted | 1ms | 320 KiB | ||||
subtask3 | 40/40 | ||||||
14 | Accepted | 1ms | 508 KiB | ||||
15 | Accepted | 1ms | 320 KiB | ||||
16 | Accepted | 1ms | 320 KiB | ||||
17 | Accepted | 1ms | 320 KiB | ||||
18 | Accepted | 1ms | 392 KiB | ||||
19 | Accepted | 1ms | 500 KiB | ||||
20 | Accepted | 1ms | 512 KiB | ||||
21 | Accepted | 1ms | 320 KiB | ||||
22 | Accepted | 1ms | 324 KiB | ||||
23 | Accepted | 1ms | 320 KiB | ||||
24 | Accepted | 1ms | 500 KiB | ||||
25 | Accepted | 1ms | 320 KiB | ||||
26 | Accepted | 1ms | 320 KiB | ||||
subtask4 | 40/40 | ||||||
27 | Accepted | 43ms | 2004 KiB | ||||
28 | Accepted | 43ms | 1848 KiB | ||||
29 | Accepted | 43ms | 2012 KiB | ||||
30 | Accepted | 43ms | 2012 KiB | ||||
31 | Accepted | 43ms | 2028 KiB | ||||
32 | Accepted | 43ms | 1848 KiB | ||||
33 | Accepted | 43ms | 2028 KiB | ||||
34 | Accepted | 43ms | 2040 KiB | ||||
35 | Accepted | 43ms | 2040 KiB | ||||
36 | Accepted | 29ms | 1848 KiB | ||||
37 | Accepted | 43ms | 1848 KiB | ||||
38 | Accepted | 21ms | 2000 KiB | ||||
39 | Accepted | 43ms | 2004 KiB | ||||
40 | Accepted | 41ms | 2028 KiB | ||||
41 | Accepted | 32ms | 2004 KiB | ||||
42 | Accepted | 41ms | 2004 KiB | ||||
43 | Accepted | 32ms | 2040 KiB |