用户输出
4
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#63260 | #1031. JM的特快列车 | Accepted | 100 | 374 ms | 1144 K | C++ 11 / 992 B | 电类047-王宇晗 | 2021-07-21 17:53:03 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, k, *d, *t;
cin >> n >> m >> k;
d = (int*)malloc((n + 2) * sizeof(int));
t = (int*)malloc((n + 2) * sizeof(int));
d[0] = 0;
d[n + 1] = k;
int l = 0, r = k;
for (int i = 1; i <= n; i++) {
scanf("%d", &d[i]);
}
n++;
sort(d, d + n + 1);
for (int i = n; i >= 1; i--) {
d[i] = d[i] - d[i - 1];
if (l > d[i])
l = d[i];
if (r < d[i])
r = d[i];
}
while (l < r) {
for (int i = 1; i <= n; i++) t[i] = d[i];
int mid = (l + r) / 2;
int count = 0;
for (int i = 1; i <= n; i++) {
if (t[i] <= mid) {
count++;
t[i + 1] = t[i + 1] + t[i];
}
}
if (count <= m)
l = mid + 1;
else
r = mid;
}
cout << r;
return 0;
}
95081 77335 568254347
160731933 121592942 545359032 42372661 94548234 31387055 297203963 120233938
<930969 bytes omitted>
用户输出
25967
系统信息
Exited with return code 0
93202 26371 640243133
544564116 20205828 399307350 600697625 98046473 248585032 150738566 19380659
<915056 bytes omitted>
用户输出
2706
系统信息
Exited with return code 0
98726 15172 4863256
4061736 2523417 2966284 1702310 1537399 4510660 4013440 4354876 2840737 4397394
<767088 bytes omitted>
用户输出
9
系统信息
Exited with return code 0
100000 99862 197697696
189350415 146517714 171890535 104293377 143894247 186136108 163590632 166302
<943029 bytes omitted>
用户输出
1420180
系统信息
Exited with return code 0
100000 142 25917879
25050015 18738442 17905039 7617439 1530367 10773344 8382003 14486136 11569183 2
<856866 bytes omitted>
用户输出
1
系统信息
Exited with return code 0
100000 0 409108430
185938952 21819912 310245988 320735736 37814393 158165858 368886326 407468247 43
<971434 bytes omitted>
用户输出
1
系统信息
Exited with return code 0
100000 100000 595536117
374138900 81845477 282044690 198472228 155427374 591666576 348669485 576466
<979298 bytes omitted>
用户输出
595536117
系统信息
Exited with return code 0
100000 69297 100001
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 3
<588817 bytes omitted>
用户输出
3
系统信息
Exited with return code 0
100000 85178 1000000000
2 4 6 8 9 10 12 14 16 18 19 20 22 23 24 25 27 29 31 32 33 35 36 37 39 41 42
<625941 bytes omitted>
用户输出
9
系统信息
Exited with return code 0
100000 14352 1000000000
1 2 3 5 7 8 10 12 13 15 16 18 20 21 23 25 26 27 29 31 32 33 35 37 38 40 41
<625955 bytes omitted>
用户输出
1
系统信息
Exited with return code 0
100000 99999 100031
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 3
<588817 bytes omitted>
用户输出
50015
系统信息
Exited with return code 0
100000 45195 916842072
4 5 9 11 12 13 14 17 21 25 27 30 34 36 40 42 45 46 49 50 54 57 61 62 64 65 6
<655452 bytes omitted>
用户输出
3
系统信息
Exited with return code 0
100000 2321 623818276
4 7 11 14 16 20 24 28 29 31 33 37 41 44 47 51 52 55 59 63 65 67 68 70 74 76 7
<655432 bytes omitted>
用户输出
1
系统信息
Exited with return code 0
100000 63443 223616492
2 4 6 9 10 14 16 20 23 25 28 29 33 36 38 40 41 42 44 45 49 51 54 58 59 61 64
<655623 bytes omitted>
用户输出
5
系统信息
Exited with return code 0