답안 #82676

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
82676 2018-11-01T09:57:57 Z Bodo171 Semiexpress (JOI17_semiexpress) C++14
0 / 100
2 ms 256 KB
#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*(cnt-1)*b>=0)
           act[0]=(1LL*T-(cnt-1)*b)/a+1;
        else act[0]=0;
        cout<<act[0]<<' ';
        for(coef=1;coef<=k;coef++)
        {
            if(1LL*T-(cnt-1)*b-coef*c>=0) act[coef]=act[coef-1]+(1LL*T-(cnt-1)*b-coef*c)/a;
            else act[coef]=act[coef-1];
            act[coef]=min(act[coef],v[cnt+1]-v[cnt]);
            cout<<act[coef]<<' ';
        }
        cout<<'\n';
        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-1;
    if(T-1LL*cnt*b>=0)
        dp[k]++;
    cout<<dp[k]-1;//vezi ultima statie
    return 0;
}

Compilation message

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:10:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("data.in","r",stdin);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -