#include "bits/stdc++.h"
using namespace std;
#define ar array
typedef long long ll;
#define int ll
const int N = 1e3 + 5;
int x[N], dp[N][N];
signed main(){
ios::sync_with_stdio(0); cin.tie(0);
int n, k, T; cin >> n >> k >> T;
for(int i=1;i<=n;i++){
cin >> x[i];
}
x[n + 1] = x[n];
auto check = [&](int s){
int t = T * s * 2;
memset(dp, 0, sizeof dp);
dp[k][k] = 1;
for(int d=0;d<n;d++){
for(int l=1, r=1+d;l+d<=n;l++, r++){
if(!dp[l][r]) continue;
if(1 < l && (r - l + 1) * t >= x[r] - x[l - 1]){
dp[l - 1][r] = 1;
}
if(r < n && (r - l + 1) * t >= x[r + 1] - x[l]){
dp[l][r + 1] = 1;
}
}
}
return dp[1][n];
};
int l = 0, r = x[n] / (T * 2) + 1;
while(l < r){
int m = (l + r) >> 1;
if(check(m)) r = m;
else l = m + 1;
}
cout<<l<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
8148 KB |
Output is correct |
2 |
Correct |
12 ms |
8148 KB |
Output is correct |
3 |
Correct |
13 ms |
8148 KB |
Output is correct |
4 |
Correct |
14 ms |
8148 KB |
Output is correct |
5 |
Correct |
14 ms |
8148 KB |
Output is correct |
6 |
Correct |
16 ms |
8148 KB |
Output is correct |
7 |
Correct |
18 ms |
8148 KB |
Output is correct |
8 |
Correct |
13 ms |
8232 KB |
Output is correct |
9 |
Correct |
14 ms |
8228 KB |
Output is correct |
10 |
Correct |
16 ms |
8228 KB |
Output is correct |
11 |
Correct |
15 ms |
8136 KB |
Output is correct |
12 |
Correct |
12 ms |
8148 KB |
Output is correct |
13 |
Correct |
14 ms |
8232 KB |
Output is correct |
14 |
Correct |
16 ms |
8228 KB |
Output is correct |
15 |
Correct |
14 ms |
8232 KB |
Output is correct |
16 |
Correct |
14 ms |
8148 KB |
Output is correct |
17 |
Correct |
12 ms |
8148 KB |
Output is correct |
18 |
Correct |
13 ms |
8148 KB |
Output is correct |
19 |
Correct |
3 ms |
8148 KB |
Output is correct |
20 |
Correct |
21 ms |
8136 KB |
Output is correct |
21 |
Correct |
3 ms |
8148 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
8148 KB |
Output is correct |
2 |
Correct |
12 ms |
8148 KB |
Output is correct |
3 |
Correct |
13 ms |
8148 KB |
Output is correct |
4 |
Correct |
14 ms |
8148 KB |
Output is correct |
5 |
Correct |
14 ms |
8148 KB |
Output is correct |
6 |
Correct |
16 ms |
8148 KB |
Output is correct |
7 |
Correct |
18 ms |
8148 KB |
Output is correct |
8 |
Correct |
13 ms |
8232 KB |
Output is correct |
9 |
Correct |
14 ms |
8228 KB |
Output is correct |
10 |
Correct |
16 ms |
8228 KB |
Output is correct |
11 |
Correct |
15 ms |
8136 KB |
Output is correct |
12 |
Correct |
12 ms |
8148 KB |
Output is correct |
13 |
Correct |
14 ms |
8232 KB |
Output is correct |
14 |
Correct |
16 ms |
8228 KB |
Output is correct |
15 |
Correct |
14 ms |
8232 KB |
Output is correct |
16 |
Correct |
14 ms |
8148 KB |
Output is correct |
17 |
Correct |
12 ms |
8148 KB |
Output is correct |
18 |
Correct |
13 ms |
8148 KB |
Output is correct |
19 |
Correct |
3 ms |
8148 KB |
Output is correct |
20 |
Correct |
21 ms |
8136 KB |
Output is correct |
21 |
Correct |
3 ms |
8148 KB |
Output is correct |
22 |
Correct |
22 ms |
8244 KB |
Output is correct |
23 |
Correct |
19 ms |
8148 KB |
Output is correct |
24 |
Correct |
24 ms |
8148 KB |
Output is correct |
25 |
Correct |
35 ms |
8268 KB |
Output is correct |
26 |
Correct |
40 ms |
8148 KB |
Output is correct |
27 |
Correct |
39 ms |
8148 KB |
Output is correct |
28 |
Correct |
40 ms |
8148 KB |
Output is correct |
29 |
Correct |
37 ms |
8148 KB |
Output is correct |
30 |
Correct |
39 ms |
8148 KB |
Output is correct |
31 |
Correct |
39 ms |
8148 KB |
Output is correct |
32 |
Correct |
39 ms |
8148 KB |
Output is correct |
33 |
Correct |
44 ms |
8232 KB |
Output is correct |
34 |
Correct |
45 ms |
8148 KB |
Output is correct |
35 |
Correct |
42 ms |
8228 KB |
Output is correct |
36 |
Correct |
43 ms |
8148 KB |
Output is correct |
37 |
Correct |
32 ms |
8168 KB |
Output is correct |
38 |
Correct |
39 ms |
8144 KB |
Output is correct |
39 |
Correct |
39 ms |
8228 KB |
Output is correct |
40 |
Correct |
6 ms |
8148 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
8148 KB |
Output is correct |
2 |
Correct |
12 ms |
8148 KB |
Output is correct |
3 |
Correct |
13 ms |
8148 KB |
Output is correct |
4 |
Correct |
14 ms |
8148 KB |
Output is correct |
5 |
Correct |
14 ms |
8148 KB |
Output is correct |
6 |
Correct |
16 ms |
8148 KB |
Output is correct |
7 |
Correct |
18 ms |
8148 KB |
Output is correct |
8 |
Correct |
13 ms |
8232 KB |
Output is correct |
9 |
Correct |
14 ms |
8228 KB |
Output is correct |
10 |
Correct |
16 ms |
8228 KB |
Output is correct |
11 |
Correct |
15 ms |
8136 KB |
Output is correct |
12 |
Correct |
12 ms |
8148 KB |
Output is correct |
13 |
Correct |
14 ms |
8232 KB |
Output is correct |
14 |
Correct |
16 ms |
8228 KB |
Output is correct |
15 |
Correct |
14 ms |
8232 KB |
Output is correct |
16 |
Correct |
14 ms |
8148 KB |
Output is correct |
17 |
Correct |
12 ms |
8148 KB |
Output is correct |
18 |
Correct |
13 ms |
8148 KB |
Output is correct |
19 |
Correct |
3 ms |
8148 KB |
Output is correct |
20 |
Correct |
21 ms |
8136 KB |
Output is correct |
21 |
Correct |
3 ms |
8148 KB |
Output is correct |
22 |
Correct |
22 ms |
8244 KB |
Output is correct |
23 |
Correct |
19 ms |
8148 KB |
Output is correct |
24 |
Correct |
24 ms |
8148 KB |
Output is correct |
25 |
Correct |
35 ms |
8268 KB |
Output is correct |
26 |
Correct |
40 ms |
8148 KB |
Output is correct |
27 |
Correct |
39 ms |
8148 KB |
Output is correct |
28 |
Correct |
40 ms |
8148 KB |
Output is correct |
29 |
Correct |
37 ms |
8148 KB |
Output is correct |
30 |
Correct |
39 ms |
8148 KB |
Output is correct |
31 |
Correct |
39 ms |
8148 KB |
Output is correct |
32 |
Correct |
39 ms |
8148 KB |
Output is correct |
33 |
Correct |
44 ms |
8232 KB |
Output is correct |
34 |
Correct |
45 ms |
8148 KB |
Output is correct |
35 |
Correct |
42 ms |
8228 KB |
Output is correct |
36 |
Correct |
43 ms |
8148 KB |
Output is correct |
37 |
Correct |
32 ms |
8168 KB |
Output is correct |
38 |
Correct |
39 ms |
8144 KB |
Output is correct |
39 |
Correct |
39 ms |
8228 KB |
Output is correct |
40 |
Correct |
6 ms |
8148 KB |
Output is correct |
41 |
Runtime error |
1 ms |
508 KB |
Execution killed with signal 11 |
42 |
Halted |
0 ms |
0 KB |
- |