#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define int long long
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int mod = 1e9 + 7;
const int LOG = 20;
const int maxn = 1e5 + 5;
int dp[1005][1005];
signed main() {
int n, id, t, l=0, r=1e9, ans=1e9; cin >> n >> id >> t;
vector<ll> v(n+1);
for(int i=1; i<=n; i++) cin >> v[i];
while(l <= r) {
int mid = (l + r) / 2;
memset(dp, 0, sizeof(dp));
dp[id][id] = 1;
for(int len=2; len<=n; len++)
for(int i=1, j=len; j<=n; i++,j++)
if(v[j] - v[i] <= 2ll * mid * (j - i) * t) dp[i][j] = (dp[i+1][j] || dp[i][j-1]);
if(dp[1][n]) ans = mid, r = mid - 1;
else l = mid + 1;
}
cout << ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
8284 KB |
Output is correct |
2 |
Correct |
7 ms |
8224 KB |
Output is correct |
3 |
Correct |
7 ms |
8328 KB |
Output is correct |
4 |
Correct |
9 ms |
8284 KB |
Output is correct |
5 |
Correct |
9 ms |
8340 KB |
Output is correct |
6 |
Correct |
9 ms |
8292 KB |
Output is correct |
7 |
Correct |
9 ms |
8284 KB |
Output is correct |
8 |
Correct |
8 ms |
8284 KB |
Output is correct |
9 |
Correct |
8 ms |
8340 KB |
Output is correct |
10 |
Correct |
8 ms |
8280 KB |
Output is correct |
11 |
Correct |
8 ms |
8284 KB |
Output is correct |
12 |
Correct |
8 ms |
8336 KB |
Output is correct |
13 |
Correct |
8 ms |
8284 KB |
Output is correct |
14 |
Correct |
8 ms |
8340 KB |
Output is correct |
15 |
Correct |
7 ms |
8284 KB |
Output is correct |
16 |
Correct |
7 ms |
8136 KB |
Output is correct |
17 |
Correct |
8 ms |
8284 KB |
Output is correct |
18 |
Correct |
8 ms |
8092 KB |
Output is correct |
19 |
Correct |
8 ms |
8280 KB |
Output is correct |
20 |
Correct |
8 ms |
8284 KB |
Output is correct |
21 |
Correct |
8 ms |
8284 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
8284 KB |
Output is correct |
2 |
Correct |
7 ms |
8224 KB |
Output is correct |
3 |
Correct |
7 ms |
8328 KB |
Output is correct |
4 |
Correct |
9 ms |
8284 KB |
Output is correct |
5 |
Correct |
9 ms |
8340 KB |
Output is correct |
6 |
Correct |
9 ms |
8292 KB |
Output is correct |
7 |
Correct |
9 ms |
8284 KB |
Output is correct |
8 |
Correct |
8 ms |
8284 KB |
Output is correct |
9 |
Correct |
8 ms |
8340 KB |
Output is correct |
10 |
Correct |
8 ms |
8280 KB |
Output is correct |
11 |
Correct |
8 ms |
8284 KB |
Output is correct |
12 |
Correct |
8 ms |
8336 KB |
Output is correct |
13 |
Correct |
8 ms |
8284 KB |
Output is correct |
14 |
Correct |
8 ms |
8340 KB |
Output is correct |
15 |
Correct |
7 ms |
8284 KB |
Output is correct |
16 |
Correct |
7 ms |
8136 KB |
Output is correct |
17 |
Correct |
8 ms |
8284 KB |
Output is correct |
18 |
Correct |
8 ms |
8092 KB |
Output is correct |
19 |
Correct |
8 ms |
8280 KB |
Output is correct |
20 |
Correct |
8 ms |
8284 KB |
Output is correct |
21 |
Correct |
8 ms |
8284 KB |
Output is correct |
22 |
Correct |
20 ms |
8156 KB |
Output is correct |
23 |
Correct |
15 ms |
8340 KB |
Output is correct |
24 |
Correct |
20 ms |
8284 KB |
Output is correct |
25 |
Correct |
32 ms |
8280 KB |
Output is correct |
26 |
Correct |
30 ms |
8280 KB |
Output is correct |
27 |
Correct |
31 ms |
8284 KB |
Output is correct |
28 |
Correct |
32 ms |
8284 KB |
Output is correct |
29 |
Correct |
30 ms |
8280 KB |
Output is correct |
30 |
Correct |
31 ms |
8284 KB |
Output is correct |
31 |
Correct |
33 ms |
8284 KB |
Output is correct |
32 |
Correct |
32 ms |
8284 KB |
Output is correct |
33 |
Correct |
30 ms |
8280 KB |
Output is correct |
34 |
Correct |
31 ms |
8344 KB |
Output is correct |
35 |
Correct |
31 ms |
8284 KB |
Output is correct |
36 |
Correct |
31 ms |
8284 KB |
Output is correct |
37 |
Correct |
30 ms |
8284 KB |
Output is correct |
38 |
Correct |
30 ms |
8280 KB |
Output is correct |
39 |
Correct |
32 ms |
8284 KB |
Output is correct |
40 |
Correct |
28 ms |
8344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
8284 KB |
Output is correct |
2 |
Correct |
7 ms |
8224 KB |
Output is correct |
3 |
Correct |
7 ms |
8328 KB |
Output is correct |
4 |
Correct |
9 ms |
8284 KB |
Output is correct |
5 |
Correct |
9 ms |
8340 KB |
Output is correct |
6 |
Correct |
9 ms |
8292 KB |
Output is correct |
7 |
Correct |
9 ms |
8284 KB |
Output is correct |
8 |
Correct |
8 ms |
8284 KB |
Output is correct |
9 |
Correct |
8 ms |
8340 KB |
Output is correct |
10 |
Correct |
8 ms |
8280 KB |
Output is correct |
11 |
Correct |
8 ms |
8284 KB |
Output is correct |
12 |
Correct |
8 ms |
8336 KB |
Output is correct |
13 |
Correct |
8 ms |
8284 KB |
Output is correct |
14 |
Correct |
8 ms |
8340 KB |
Output is correct |
15 |
Correct |
7 ms |
8284 KB |
Output is correct |
16 |
Correct |
7 ms |
8136 KB |
Output is correct |
17 |
Correct |
8 ms |
8284 KB |
Output is correct |
18 |
Correct |
8 ms |
8092 KB |
Output is correct |
19 |
Correct |
8 ms |
8280 KB |
Output is correct |
20 |
Correct |
8 ms |
8284 KB |
Output is correct |
21 |
Correct |
8 ms |
8284 KB |
Output is correct |
22 |
Correct |
20 ms |
8156 KB |
Output is correct |
23 |
Correct |
15 ms |
8340 KB |
Output is correct |
24 |
Correct |
20 ms |
8284 KB |
Output is correct |
25 |
Correct |
32 ms |
8280 KB |
Output is correct |
26 |
Correct |
30 ms |
8280 KB |
Output is correct |
27 |
Correct |
31 ms |
8284 KB |
Output is correct |
28 |
Correct |
32 ms |
8284 KB |
Output is correct |
29 |
Correct |
30 ms |
8280 KB |
Output is correct |
30 |
Correct |
31 ms |
8284 KB |
Output is correct |
31 |
Correct |
33 ms |
8284 KB |
Output is correct |
32 |
Correct |
32 ms |
8284 KB |
Output is correct |
33 |
Correct |
30 ms |
8280 KB |
Output is correct |
34 |
Correct |
31 ms |
8344 KB |
Output is correct |
35 |
Correct |
31 ms |
8284 KB |
Output is correct |
36 |
Correct |
31 ms |
8284 KB |
Output is correct |
37 |
Correct |
30 ms |
8284 KB |
Output is correct |
38 |
Correct |
30 ms |
8280 KB |
Output is correct |
39 |
Correct |
32 ms |
8284 KB |
Output is correct |
40 |
Correct |
28 ms |
8344 KB |
Output is correct |
41 |
Runtime error |
26 ms |
17500 KB |
Execution killed with signal 11 |
42 |
Halted |
0 ms |
0 KB |
- |