6708 | 2023-12-17 18:10:55 | MagyarKendeSZLG | Pontos Átlag | cpp17 | Wrong answer 0/100 | 46ms | 6376 KiB |
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N, K, sum;
cin >> N >> K;
vector<int> P(N);
for (int i = 0; i < N; i++) {
cin >> P[i];
sum += P[i];
}
sort(P.begin(), P.end());
const int prod = N * K;
if (prod == sum) {
cout << 0 << endl;
} else if (prod > sum) {
cout << 1 << endl;
} else {
for (int i = N - 1, result = 0; i >= 0; i--) {
sum -= P[i] - 1;
result++;
if (prod >= sum) {
cout << result << endl;
return 0;
}
}
}
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 3ms | 1860 KiB | ||||
2 | Accepted | 3ms | 2004 KiB | ||||
subtask2 | 0/20 | ||||||
3 | Accepted | 3ms | 2124 KiB | ||||
4 | Accepted | 3ms | 2328 KiB | ||||
5 | Wrong answer | 3ms | 2688 KiB | ||||
6 | Accepted | 3ms | 2628 KiB | ||||
7 | Accepted | 3ms | 2624 KiB | ||||
8 | Accepted | 3ms | 2760 KiB | ||||
9 | Accepted | 3ms | 2968 KiB | ||||
10 | Wrong answer | 3ms | 3180 KiB | ||||
11 | Accepted | 3ms | 3408 KiB | ||||
12 | Accepted | 3ms | 3504 KiB | ||||
13 | Wrong answer | 3ms | 3492 KiB | ||||
subtask3 | 0/40 | ||||||
14 | Accepted | 3ms | 3608 KiB | ||||
15 | Accepted | 3ms | 3712 KiB | ||||
16 | Accepted | 3ms | 3824 KiB | ||||
17 | Accepted | 3ms | 3908 KiB | ||||
18 | Accepted | 3ms | 3904 KiB | ||||
19 | Accepted | 3ms | 3908 KiB | ||||
20 | Wrong answer | 3ms | 3904 KiB | ||||
21 | Wrong answer | 3ms | 3904 KiB | ||||
22 | Accepted | 3ms | 4272 KiB | ||||
23 | Accepted | 3ms | 4172 KiB | ||||
24 | Wrong answer | 3ms | 4260 KiB | ||||
25 | Accepted | 3ms | 4256 KiB | ||||
26 | Wrong answer | 3ms | 4264 KiB | ||||
subtask4 | 0/40 | ||||||
27 | Wrong answer | 46ms | 5596 KiB | ||||
28 | Partially correct | 46ms | 5744 KiB | ||||
29 | Wrong answer | 46ms | 5652 KiB | ||||
30 | Partially correct | 46ms | 5868 KiB | ||||
31 | Partially correct | 46ms | 6056 KiB | ||||
32 | Partially correct | 46ms | 6304 KiB | ||||
33 | Wrong answer | 46ms | 6376 KiB | ||||
34 | Partially correct | 46ms | 6368 KiB | ||||
35 | Partially correct | 46ms | 6256 KiB | ||||
36 | Wrong answer | 30ms | 6256 KiB | ||||
37 | Wrong answer | 46ms | 6204 KiB | ||||
38 | Accepted | 23ms | 6280 KiB | ||||
39 | Accepted | 46ms | 6136 KiB | ||||
40 | Wrong answer | 45ms | 6132 KiB | ||||
41 | Accepted | 35ms | 6200 KiB | ||||
42 | Wrong answer | 46ms | 6196 KiB | ||||
43 | Wrong answer | 34ms | 6204 KiB |