#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll N, K, T, A[100005];
ll D[1005][1005];
void f(ll s, ll e, ll v){
if(s >= 2 && D[s - 1][e] == -1){
if(A[e] - A[s - 1] <= (e - s + 1) * T * 2 * v){
D[s - 1][e] = 1;
f(s - 1, e, v);
} else {
D[s - 1][e] = 0;
}
}
if(e < N && D[s][e + 1] == -1){
if(A[e + 1] - A[s] <= (e - s + 1) * T * 2 * v){
D[s][e + 1] = 1;
f(s, e + 1, v);
} else {
D[s][e + 1] = 0;
}
}
}
int main(){
cin.tie(0) -> sync_with_stdio(0);
cin >> N >> K >> T;
for(ll i = 1; i <= N; i++){
cin >> A[i];
}
if(A[N] == 0){
cout << 0; return 0;
}
ll L = 1, R = 1e9;
while(L <= R){
ll m = (L + R) / 2;
fill(D[0], D[1004] + 1005, -1LL);
D[K][K] = 1;
f(K, K, m);
if(D[1][N] == 1) R = m - 1;
else L = m + 1;
}
cout << L;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
8280 KB |
Output is correct |
2 |
Correct |
9 ms |
8284 KB |
Output is correct |
3 |
Correct |
8 ms |
8280 KB |
Output is correct |
4 |
Correct |
10 ms |
8284 KB |
Output is correct |
5 |
Correct |
8 ms |
8284 KB |
Output is correct |
6 |
Correct |
8 ms |
8284 KB |
Output is correct |
7 |
Correct |
10 ms |
8376 KB |
Output is correct |
8 |
Correct |
9 ms |
8372 KB |
Output is correct |
9 |
Correct |
10 ms |
8280 KB |
Output is correct |
10 |
Correct |
9 ms |
8284 KB |
Output is correct |
11 |
Correct |
8 ms |
8284 KB |
Output is correct |
12 |
Correct |
10 ms |
8372 KB |
Output is correct |
13 |
Correct |
9 ms |
8284 KB |
Output is correct |
14 |
Correct |
9 ms |
8284 KB |
Output is correct |
15 |
Correct |
9 ms |
8280 KB |
Output is correct |
16 |
Correct |
8 ms |
8276 KB |
Output is correct |
17 |
Correct |
9 ms |
8372 KB |
Output is correct |
18 |
Correct |
8 ms |
8368 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
9 ms |
8216 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
8280 KB |
Output is correct |
2 |
Correct |
9 ms |
8284 KB |
Output is correct |
3 |
Correct |
8 ms |
8280 KB |
Output is correct |
4 |
Correct |
10 ms |
8284 KB |
Output is correct |
5 |
Correct |
8 ms |
8284 KB |
Output is correct |
6 |
Correct |
8 ms |
8284 KB |
Output is correct |
7 |
Correct |
10 ms |
8376 KB |
Output is correct |
8 |
Correct |
9 ms |
8372 KB |
Output is correct |
9 |
Correct |
10 ms |
8280 KB |
Output is correct |
10 |
Correct |
9 ms |
8284 KB |
Output is correct |
11 |
Correct |
8 ms |
8284 KB |
Output is correct |
12 |
Correct |
10 ms |
8372 KB |
Output is correct |
13 |
Correct |
9 ms |
8284 KB |
Output is correct |
14 |
Correct |
9 ms |
8284 KB |
Output is correct |
15 |
Correct |
9 ms |
8280 KB |
Output is correct |
16 |
Correct |
8 ms |
8276 KB |
Output is correct |
17 |
Correct |
9 ms |
8372 KB |
Output is correct |
18 |
Correct |
8 ms |
8368 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
9 ms |
8216 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
14 ms |
8284 KB |
Output is correct |
23 |
Correct |
11 ms |
8284 KB |
Output is correct |
24 |
Correct |
9 ms |
8284 KB |
Output is correct |
25 |
Correct |
9 ms |
8284 KB |
Output is correct |
26 |
Correct |
12 ms |
8284 KB |
Output is correct |
27 |
Correct |
13 ms |
8280 KB |
Output is correct |
28 |
Correct |
16 ms |
8284 KB |
Output is correct |
29 |
Correct |
15 ms |
8436 KB |
Output is correct |
30 |
Correct |
14 ms |
8284 KB |
Output is correct |
31 |
Correct |
15 ms |
8444 KB |
Output is correct |
32 |
Correct |
17 ms |
8284 KB |
Output is correct |
33 |
Correct |
17 ms |
8284 KB |
Output is correct |
34 |
Correct |
14 ms |
8284 KB |
Output is correct |
35 |
Correct |
20 ms |
8436 KB |
Output is correct |
36 |
Correct |
12 ms |
8284 KB |
Output is correct |
37 |
Correct |
12 ms |
8392 KB |
Output is correct |
38 |
Correct |
16 ms |
8444 KB |
Output is correct |
39 |
Correct |
11 ms |
8284 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
8280 KB |
Output is correct |
2 |
Correct |
9 ms |
8284 KB |
Output is correct |
3 |
Correct |
8 ms |
8280 KB |
Output is correct |
4 |
Correct |
10 ms |
8284 KB |
Output is correct |
5 |
Correct |
8 ms |
8284 KB |
Output is correct |
6 |
Correct |
8 ms |
8284 KB |
Output is correct |
7 |
Correct |
10 ms |
8376 KB |
Output is correct |
8 |
Correct |
9 ms |
8372 KB |
Output is correct |
9 |
Correct |
10 ms |
8280 KB |
Output is correct |
10 |
Correct |
9 ms |
8284 KB |
Output is correct |
11 |
Correct |
8 ms |
8284 KB |
Output is correct |
12 |
Correct |
10 ms |
8372 KB |
Output is correct |
13 |
Correct |
9 ms |
8284 KB |
Output is correct |
14 |
Correct |
9 ms |
8284 KB |
Output is correct |
15 |
Correct |
9 ms |
8280 KB |
Output is correct |
16 |
Correct |
8 ms |
8276 KB |
Output is correct |
17 |
Correct |
9 ms |
8372 KB |
Output is correct |
18 |
Correct |
8 ms |
8368 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
9 ms |
8216 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
14 ms |
8284 KB |
Output is correct |
23 |
Correct |
11 ms |
8284 KB |
Output is correct |
24 |
Correct |
9 ms |
8284 KB |
Output is correct |
25 |
Correct |
9 ms |
8284 KB |
Output is correct |
26 |
Correct |
12 ms |
8284 KB |
Output is correct |
27 |
Correct |
13 ms |
8280 KB |
Output is correct |
28 |
Correct |
16 ms |
8284 KB |
Output is correct |
29 |
Correct |
15 ms |
8436 KB |
Output is correct |
30 |
Correct |
14 ms |
8284 KB |
Output is correct |
31 |
Correct |
15 ms |
8444 KB |
Output is correct |
32 |
Correct |
17 ms |
8284 KB |
Output is correct |
33 |
Correct |
17 ms |
8284 KB |
Output is correct |
34 |
Correct |
14 ms |
8284 KB |
Output is correct |
35 |
Correct |
20 ms |
8436 KB |
Output is correct |
36 |
Correct |
12 ms |
8284 KB |
Output is correct |
37 |
Correct |
12 ms |
8392 KB |
Output is correct |
38 |
Correct |
16 ms |
8444 KB |
Output is correct |
39 |
Correct |
11 ms |
8284 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Runtime error |
15 ms |
18268 KB |
Execution killed with signal 11 |
42 |
Halted |
0 ms |
0 KB |
- |