11525 | 2024-10-19 09:42:55 | Dávid | Pontos Átlag | cpp17 | Accepted 100/100 | 94ms | 1988 KiB |
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
vector<long long> arak(n);
long long osszeg = 0;
for(int i = 0; i < n; i++) {
cin >> arak[i];
osszeg += arak[i];
}
if(osszeg < n * k) {
cout << 1 << endl;
return 0;
}
sort(arak.rbegin(), arak.rend());
int eredmeny = 0;
for(int i = 0; i < n; i++) {
if(osszeg > n * k) {
osszeg -= min(arak[i] - 1, osszeg - n * k);
eredmeny++;
}
}
cout << eredmeny << endl;
return 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 | 320 KiB | ||||
7 | Accepted | 1ms | 320 KiB | ||||
8 | Accepted | 1ms | 320 KiB | ||||
9 | Accepted | 1ms | 500 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 | 320 KiB | ||||
15 | Accepted | 1ms | 320 KiB | ||||
16 | Accepted | 1ms | 320 KiB | ||||
17 | Accepted | 1ms | 320 KiB | ||||
18 | Accepted | 1ms | 376 KiB | ||||
19 | Accepted | 1ms | 584 KiB | ||||
20 | Accepted | 1ms | 412 KiB | ||||
21 | Accepted | 1ms | 320 KiB | ||||
22 | Accepted | 1ms | 320 KiB | ||||
23 | Accepted | 1ms | 320 KiB | ||||
24 | Accepted | 1ms | 320 KiB | ||||
25 | Accepted | 1ms | 320 KiB | ||||
26 | Accepted | 1ms | 320 KiB | ||||
subtask4 | 40/40 | ||||||
27 | Accepted | 75ms | 1848 KiB | ||||
28 | Accepted | 93ms | 1980 KiB | ||||
29 | Accepted | 93ms | 1848 KiB | ||||
30 | Accepted | 93ms | 1848 KiB | ||||
31 | Accepted | 93ms | 1984 KiB | ||||
32 | Accepted | 93ms | 1984 KiB | ||||
33 | Accepted | 93ms | 1848 KiB | ||||
34 | Accepted | 93ms | 1980 KiB | ||||
35 | Accepted | 93ms | 1980 KiB | ||||
36 | Accepted | 82ms | 1848 KiB | ||||
37 | Accepted | 93ms | 1984 KiB | ||||
38 | Accepted | 43ms | 1984 KiB | ||||
39 | Accepted | 90ms | 1852 KiB | ||||
40 | Accepted | 94ms | 1848 KiB | ||||
41 | Accepted | 68ms | 1972 KiB | ||||
42 | Accepted | 92ms | 1988 KiB | ||||
43 | Accepted | 63ms | 1848 KiB |