6919 | 2023-12-19 18:42:22 | 111 | Pontos átlag 2 | cpp17 | Wrong answer 0/100 | 78ms | 8120 KiB |
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define pii pair<int, int>
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifdef CB
freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
#endif
int N, K;
cin >> N >> K;
vector<int> v(N);
for (int i = 0; i < N; i++) {
cin >> v[i];
}
int l = 0, h = 1e9;
while (l < h) {
int m = (l + h) / 2;
int SL = 0, SH = 0;
for (int i = 0; i < N; i++) {
SL += v[i] - m;
SH += v[i] + m;
}
if (SL <= N * K && SH >= N * K) {
h = m;
}
else {
l = m + 1;
}
}
cout << l << '\n';
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 3ms | 1832 KiB | ||||
2 | Accepted | 3ms | 2024 KiB | ||||
subtask2 | 0/10 | ||||||
3 | Accepted | 3ms | 2240 KiB | ||||
4 | Wrong answer | 3ms | 2448 KiB | ||||
5 | Accepted | 3ms | 2672 KiB | ||||
6 | Accepted | 3ms | 2868 KiB | ||||
7 | Accepted | 3ms | 3108 KiB | ||||
8 | Accepted | 3ms | 3304 KiB | ||||
subtask3 | 0/20 | ||||||
9 | Accepted | 64ms | 6276 KiB | ||||
10 | Wrong answer | 64ms | 6552 KiB | ||||
11 | Accepted | 61ms | 6648 KiB | ||||
12 | Accepted | 63ms | 6496 KiB | ||||
13 | Accepted | 64ms | 6840 KiB | ||||
14 | Accepted | 64ms | 6772 KiB | ||||
15 | Wrong answer | 64ms | 7028 KiB | ||||
16 | Wrong answer | 64ms | 7240 KiB | ||||
17 | Accepted | 3ms | 4440 KiB | ||||
subtask4 | 0/24 | ||||||
18 | Wrong answer | 3ms | 4552 KiB | ||||
19 | Wrong answer | 3ms | 4624 KiB | ||||
20 | Wrong answer | 3ms | 4592 KiB | ||||
21 | Wrong answer | 3ms | 4596 KiB | ||||
22 | Wrong answer | 3ms | 4412 KiB | ||||
23 | Accepted | 3ms | 4496 KiB | ||||
24 | Accepted | 3ms | 4496 KiB | ||||
25 | Accepted | 3ms | 4516 KiB | ||||
26 | Wrong answer | 3ms | 4472 KiB | ||||
27 | Wrong answer | 3ms | 4596 KiB | ||||
28 | Accepted | 3ms | 4624 KiB | ||||
subtask5 | 0/46 | ||||||
29 | Wrong answer | 64ms | 7844 KiB | ||||
30 | Wrong answer | 70ms | 7856 KiB | ||||
31 | Wrong answer | 41ms | 6892 KiB | ||||
32 | Accepted | 61ms | 7644 KiB | ||||
33 | Wrong answer | 74ms | 8048 KiB | ||||
34 | Wrong answer | 75ms | 7920 KiB | ||||
35 | Accepted | 78ms | 8120 KiB | ||||
36 | Wrong answer | 78ms | 8104 KiB | ||||
37 | Wrong answer | 78ms | 8028 KiB | ||||
38 | Accepted | 75ms | 7984 KiB | ||||
39 | Wrong answer | 28ms | 6060 KiB | ||||
40 | Wrong answer | 4ms | 5432 KiB | ||||
41 | Accepted | 3ms | 5212 KiB |