#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvll = vector<vll>;
using vvi = vector<vi>;
#define sz(x) int(x.size())
int main()
{
ll N, K, T;
cin >> N >> K >> T;
vll X(1+N);
for(int i = 1; i <= N; i++)
{
cin >> X[i];
}
ll lo = 1, hi = 1'000'000'000/T + 1;
while(lo != hi)
{
ll mid = (lo + hi)/2;
vvll dp(1+N, vll(1+N, 0));
for(ll l = N; l >= 1; l--)
{
for(ll r = l; r <= N; r++)
{
if(l == r)
dp[l][r] = 1;
else if(2LL * T * (r-l) * mid < X[r] - X[l])
dp[l][r] = 0;
else
dp[l][r] = dp[l+1][r] || dp[l][r-1];
}
}
if(dp[1][N] == 1)
hi = mid;
else
lo = mid+1;
}
cout << lo << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |