6535 | 2023-12-07 22:00:59 | TuruTamas | Pontos Átlag | cpp17 | Wrong answer 0/100 | 97ms | 7996 KiB |
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
ifstream in_file("minta/be1.txt");
#define input in_file
#else
#define input cin
#endif
typedef unsigned long long ull;
ull N, K, ossz;
ull P[200'000];
int main() {
input >> N >> K;
K *= N;
for (int n = 0; n < N; n++) {
input >> P[n];
ossz += P[n];
}
if (ossz == K) {
cout << 0 << endl;
exit(0);
}
sort(P, P+N);
ull r = 0;
if (K > ossz) {
for (ull i = 0; i < N; i++) {
ossz += 1'000'000-P[i];
r++;
if (ossz >= K) {
cout << r << endl;
exit(0);
}
}
}
else {
for (ull i = N-1; i >= 0; i--) {
ossz -= P[i]-1;
r++;
if (ossz <= K) {
cout << r << endl;
exit(0);
}
}
}
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1884 KiB | ||||
2 | Accepted | 3ms | 2076 KiB | ||||
subtask2 | 0/20 | ||||||
3 | Accepted | 3ms | 2552 KiB | ||||
4 | Wrong answer | 2ms | 2596 KiB | ||||
5 | Accepted | 2ms | 2504 KiB | ||||
6 | Accepted | 3ms | 2712 KiB | ||||
7 | Accepted | 3ms | 2916 KiB | ||||
8 | Accepted | 2ms | 2916 KiB | ||||
9 | Accepted | 3ms | 3048 KiB | ||||
10 | Accepted | 3ms | 3272 KiB | ||||
11 | Accepted | 3ms | 3652 KiB | ||||
12 | Accepted | 3ms | 3620 KiB | ||||
13 | Accepted | 3ms | 3672 KiB | ||||
subtask3 | 0/40 | ||||||
14 | Wrong answer | 3ms | 3664 KiB | ||||
15 | Accepted | 3ms | 3724 KiB | ||||
16 | Accepted | 3ms | 3948 KiB | ||||
17 | Accepted | 3ms | 3932 KiB | ||||
18 | Accepted | 3ms | 4064 KiB | ||||
19 | Accepted | 3ms | 4276 KiB | ||||
20 | Accepted | 3ms | 4360 KiB | ||||
21 | Accepted | 3ms | 4388 KiB | ||||
22 | Accepted | 3ms | 4480 KiB | ||||
23 | Accepted | 3ms | 4404 KiB | ||||
24 | Accepted | 3ms | 4588 KiB | ||||
25 | Accepted | 3ms | 4676 KiB | ||||
26 | Accepted | 3ms | 4672 KiB | ||||
subtask4 | 0/40 | ||||||
27 | Wrong answer | 93ms | 7760 KiB | ||||
28 | Accepted | 93ms | 7760 KiB | ||||
29 | Accepted | 97ms | 7996 KiB | ||||
30 | Accepted | 93ms | 7864 KiB | ||||
31 | Accepted | 93ms | 7848 KiB | ||||
32 | Accepted | 93ms | 7756 KiB | ||||
33 | Accepted | 93ms | 7756 KiB | ||||
34 | Accepted | 94ms | 7760 KiB | ||||
35 | Accepted | 93ms | 7760 KiB | ||||
36 | Accepted | 83ms | 7760 KiB | ||||
37 | Accepted | 75ms | 7888 KiB | ||||
38 | Accepted | 45ms | 7760 KiB | ||||
39 | Accepted | 90ms | 7760 KiB | ||||
40 | Accepted | 93ms | 7756 KiB | ||||
41 | Accepted | 68ms | 7756 KiB | ||||
42 | Accepted | 92ms | 7844 KiB | ||||
43 | Accepted | 64ms | 7852 KiB |