用户输出
4
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#20442 | #1031. JM的特快列车 | Accepted | 100 | 311 ms | 1000 K | C++ / 1.3 K | q3540555 | 2019-07-22 15:20:38 |
#include <map>
#include <ctime>
#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define spause() system("pause")
//#define scanf scanf_s
using namespace std;
typedef long long llong;
typedef unsigned long long ullong;
typedef pair<int, int> prdd;
const llong inf = 0x7fffffffffffffff;
const double mrg = 1e9, efs = 1e-5;
int n, m, dis;
vector<int> sta;
void search(int l, int r);
bool check(int spa);
int main() {
scanf("%d%d%d", &n, &m, &dis);
sta.push_back(0);
for (int i = 0; i < n; i++) {
int tmp;
scanf("%d", &tmp);
sta.push_back(tmp);
}
sta.push_back(dis);
sort(sta.begin(), sta.end());
search(0, dis + 1);
// spause();
return 0;
}
void search(int l, int r) {
if (r - l == 1)
printf("%d", l);
else {
int mid = (l + r) >> 1;
if (check(mid))
search(mid, r);
else
search(l, mid);
}
}
bool check(int mxdis) {
int rmm = m, nwdis = 0;
for (int i = 1; i <= n + 1; i++) {
nwdis += sta.at(i) - sta.at(i - 1);
if (nwdis < mxdis)
if (rmm > 0)
rmm--;
else
return false;
else
nwdis = 0;
}
return rmm >= 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