이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <fstream>
using namespace std;
const int nmax=3005;
long long v[nmax],act[nmax],dp[nmax];
int n,m,k,i,j;
long long a,b,c,T,coef;
int main()
{
//freopen("data.in","r",stdin);
cin>>n>>m>>k;
cin>>a>>b>>c;
cin>>T;
for(i=1;i<=m;i++)
{
cin>>v[i];
}
k-=m;
for(long long cnt=1;cnt<m;cnt++)
{
if(T-1LL*(v[cnt]-1)*b>=0)
act[0]=(1LL*T-(v[cnt]-1)*b)/a;
else act[0]=0;
for(coef=1;coef<=k;coef++)
{
if(1LL*T-(v[cnt]-1)*b-(act[coef-1]+1)*c>=0) act[coef]=act[coef-1]+(1LL*T-(v[cnt]-1)*b-(act[coef-1]+1)*c)/a+1;
else act[coef]=act[coef-1];
act[coef]=min(act[coef],v[cnt+1]-v[cnt]);
}
act[0]=min(act[0],v[cnt+1]-v[cnt]);
for(coef=0;coef<=k;coef++)
if(act[coef]<v[cnt+1]-v[cnt]&&T-1LL*(v[cnt]-1)*b>=0)
act[coef]++;
for(i=k;i>=0;i--)
for(j=0;j<=i;j++)
dp[i]=max(dp[i],dp[i-j]+act[j]);
}
long long cnt=m;
if(T-1LL*(v[cnt]-1)*b>=0)
dp[k]++;
cout<<dp[k]-1;//vezi ultima statie
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |