#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long maxn=1000+10;
const long long logn=25;
long long n,k,t;
long long x[maxn];
long long dp[maxn][maxn];
long long kol=0;
long long f(long long L,long long R)
{
if(L==0 && R==n-1)
{
return true;
}
if(dp[L][R]!=-1)
{
return dp[L][R];
}
long long rez=0;
if(R<n-1 && (x[R+1]-x[L])<=(R-L+1)*t*(2*kol))
{
rez=max(rez,f(L,R+1));
}
if(L>0 && (x[R]-x[L-1])<=(R-L+1)*t*(2*kol))
{
rez=max(rez,f(L-1,R));
}
return dp[L][R]=rez;
}
int main()
{
ios::sync_with_stdio(false);
cin>>n>>k>>t;
k--;
for(long long i=0;i<n;i++)
{
cin>>x[i];
}
long long l=0;
long long r=x[n-1]-x[0];
long long ans=0;
while(l<=r)
{
memset(dp,-1,sizeof dp);
long long mid=l+(r-l)/2;
kol=mid;
if(f(k,k))
{
ans=mid;
r=mid-1;
}
else
{
l=mid+1;
}
}
cout<<ans<<endl;
/*long long m,n;
cin>>m>>n;
long long mi=2e9;
long long mx=-1;
vector<pair<pair<long long,long long>,pair<long long,long long>>>p;
vector<pair<pair<long long,long long>,pair<long long,long long>>>x;
for(long long i=0;i<m;i++)
{
long long a,b,c,d;
cin>>a>>b>>c>>d;
p.push_back({{a,b},{c,d}});
mi=min(mi,a);
mx=max(mx,b);
}
n=mx-mi+1;
map<long long,long long>m;
long long cnt=0;
for(long long i=mi;i<=mx;i++)
{
m[i]=cnt;
cnt++;
}
for(long long i=0;i<m;i++)
{
long long a=p.first.first;
long long b=p.first.second;
long long c=p.second.first;
long long d=p.second.second;
x.push_back({{m[a],m[b]},{m[c],m[d]}});
}*/
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
8280 KB |
Output is correct |
2 |
Correct |
5 ms |
8284 KB |
Output is correct |
3 |
Correct |
5 ms |
8284 KB |
Output is correct |
4 |
Correct |
5 ms |
8448 KB |
Output is correct |
5 |
Correct |
6 ms |
8284 KB |
Output is correct |
6 |
Correct |
7 ms |
8284 KB |
Output is correct |
7 |
Correct |
5 ms |
8284 KB |
Output is correct |
8 |
Correct |
5 ms |
8284 KB |
Output is correct |
9 |
Correct |
5 ms |
8280 KB |
Output is correct |
10 |
Correct |
5 ms |
8280 KB |
Output is correct |
11 |
Correct |
5 ms |
8284 KB |
Output is correct |
12 |
Correct |
5 ms |
8284 KB |
Output is correct |
13 |
Correct |
5 ms |
8240 KB |
Output is correct |
14 |
Correct |
5 ms |
8280 KB |
Output is correct |
15 |
Correct |
5 ms |
8284 KB |
Output is correct |
16 |
Correct |
5 ms |
8284 KB |
Output is correct |
17 |
Correct |
5 ms |
8444 KB |
Output is correct |
18 |
Correct |
5 ms |
8284 KB |
Output is correct |
19 |
Correct |
2 ms |
8284 KB |
Output is correct |
20 |
Correct |
6 ms |
8284 KB |
Output is correct |
21 |
Correct |
2 ms |
8284 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
8280 KB |
Output is correct |
2 |
Correct |
5 ms |
8284 KB |
Output is correct |
3 |
Correct |
5 ms |
8284 KB |
Output is correct |
4 |
Correct |
5 ms |
8448 KB |
Output is correct |
5 |
Correct |
6 ms |
8284 KB |
Output is correct |
6 |
Correct |
7 ms |
8284 KB |
Output is correct |
7 |
Correct |
5 ms |
8284 KB |
Output is correct |
8 |
Correct |
5 ms |
8284 KB |
Output is correct |
9 |
Correct |
5 ms |
8280 KB |
Output is correct |
10 |
Correct |
5 ms |
8280 KB |
Output is correct |
11 |
Correct |
5 ms |
8284 KB |
Output is correct |
12 |
Correct |
5 ms |
8284 KB |
Output is correct |
13 |
Correct |
5 ms |
8240 KB |
Output is correct |
14 |
Correct |
5 ms |
8280 KB |
Output is correct |
15 |
Correct |
5 ms |
8284 KB |
Output is correct |
16 |
Correct |
5 ms |
8284 KB |
Output is correct |
17 |
Correct |
5 ms |
8444 KB |
Output is correct |
18 |
Correct |
5 ms |
8284 KB |
Output is correct |
19 |
Correct |
2 ms |
8284 KB |
Output is correct |
20 |
Correct |
6 ms |
8284 KB |
Output is correct |
21 |
Correct |
2 ms |
8284 KB |
Output is correct |
22 |
Correct |
31 ms |
8456 KB |
Output is correct |
23 |
Correct |
24 ms |
8284 KB |
Output is correct |
24 |
Correct |
11 ms |
8536 KB |
Output is correct |
25 |
Correct |
8 ms |
8280 KB |
Output is correct |
26 |
Correct |
27 ms |
8480 KB |
Output is correct |
27 |
Correct |
31 ms |
8660 KB |
Output is correct |
28 |
Correct |
47 ms |
8280 KB |
Output is correct |
29 |
Correct |
42 ms |
8480 KB |
Output is correct |
30 |
Correct |
35 ms |
8284 KB |
Output is correct |
31 |
Correct |
35 ms |
8284 KB |
Output is correct |
32 |
Correct |
39 ms |
8480 KB |
Output is correct |
33 |
Correct |
48 ms |
8484 KB |
Output is correct |
34 |
Correct |
26 ms |
8504 KB |
Output is correct |
35 |
Correct |
48 ms |
8284 KB |
Output is correct |
36 |
Correct |
16 ms |
8280 KB |
Output is correct |
37 |
Correct |
15 ms |
8284 KB |
Output is correct |
38 |
Correct |
41 ms |
8488 KB |
Output is correct |
39 |
Correct |
15 ms |
8280 KB |
Output is correct |
40 |
Correct |
4 ms |
8536 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
8280 KB |
Output is correct |
2 |
Correct |
5 ms |
8284 KB |
Output is correct |
3 |
Correct |
5 ms |
8284 KB |
Output is correct |
4 |
Correct |
5 ms |
8448 KB |
Output is correct |
5 |
Correct |
6 ms |
8284 KB |
Output is correct |
6 |
Correct |
7 ms |
8284 KB |
Output is correct |
7 |
Correct |
5 ms |
8284 KB |
Output is correct |
8 |
Correct |
5 ms |
8284 KB |
Output is correct |
9 |
Correct |
5 ms |
8280 KB |
Output is correct |
10 |
Correct |
5 ms |
8280 KB |
Output is correct |
11 |
Correct |
5 ms |
8284 KB |
Output is correct |
12 |
Correct |
5 ms |
8284 KB |
Output is correct |
13 |
Correct |
5 ms |
8240 KB |
Output is correct |
14 |
Correct |
5 ms |
8280 KB |
Output is correct |
15 |
Correct |
5 ms |
8284 KB |
Output is correct |
16 |
Correct |
5 ms |
8284 KB |
Output is correct |
17 |
Correct |
5 ms |
8444 KB |
Output is correct |
18 |
Correct |
5 ms |
8284 KB |
Output is correct |
19 |
Correct |
2 ms |
8284 KB |
Output is correct |
20 |
Correct |
6 ms |
8284 KB |
Output is correct |
21 |
Correct |
2 ms |
8284 KB |
Output is correct |
22 |
Correct |
31 ms |
8456 KB |
Output is correct |
23 |
Correct |
24 ms |
8284 KB |
Output is correct |
24 |
Correct |
11 ms |
8536 KB |
Output is correct |
25 |
Correct |
8 ms |
8280 KB |
Output is correct |
26 |
Correct |
27 ms |
8480 KB |
Output is correct |
27 |
Correct |
31 ms |
8660 KB |
Output is correct |
28 |
Correct |
47 ms |
8280 KB |
Output is correct |
29 |
Correct |
42 ms |
8480 KB |
Output is correct |
30 |
Correct |
35 ms |
8284 KB |
Output is correct |
31 |
Correct |
35 ms |
8284 KB |
Output is correct |
32 |
Correct |
39 ms |
8480 KB |
Output is correct |
33 |
Correct |
48 ms |
8484 KB |
Output is correct |
34 |
Correct |
26 ms |
8504 KB |
Output is correct |
35 |
Correct |
48 ms |
8284 KB |
Output is correct |
36 |
Correct |
16 ms |
8280 KB |
Output is correct |
37 |
Correct |
15 ms |
8284 KB |
Output is correct |
38 |
Correct |
41 ms |
8488 KB |
Output is correct |
39 |
Correct |
15 ms |
8280 KB |
Output is correct |
40 |
Correct |
4 ms |
8536 KB |
Output is correct |
41 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 11 |
42 |
Halted |
0 ms |
0 KB |
- |