#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iterator>
#include <limits>
#include <list>
#include <numeric>
#include <random>
#include <ratio>
#include <sstream>
#include <utility>
#include <bitset>
#include <deque>
#include <queue>
#include <map>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <string>
#include <set>
using namespace std;
#define a first
#define b second
#define pb push_back
typedef long long llo;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,m,k;
cin>>n>>m>>k;
int aa,bb,cc;
cin>>aa>>bb>>cc;
int it[m];
int tt;
cin>>tt;
for(int i=0;i<m;i++){
cin>>it[i];
}
int ans=0;
int pre[m][2];
for(int i=1;i<m;i++){
int tot=0;
int tot2=0;
if((it[i]-1)*bb<=tt){
ans+=1;
}
for(int j=it[i-1];j<it[i];j++){
int co=tt-(it[i-1]-1)*bb;
if(co<=0){
continue;
}
co-=(j-it[i-1])*cc;
if(co<0){
continue;
}
int co2=tt-(it[i-1]-1)*bb;
int kk=min(1+co/aa+max(min(co2/aa,j-it[i-1]-1),0),it[i]-it[i-1]-1);
// aa.pb({j,kk});
/*if(j>0){
kk-=dd[i][j-1];
}*/
if(j==it[i-1]){
tot2=kk-1;
}
else{
tot=max(tot,kk);
}
// cout<<i<<" "<<j<<" "<<kk<<endl;
}
pre[i][0]=max(tot2,0);
pre[i][1]=tot;
// cout<<i<<"::"<<tot2<<"::"<<tot<<endl;
}
int dp[m][k+1];
for(int i=0;i<m;i++){
for(int j=0;j<k+1;j++){
dp[i][j]=0;
}
}
for(int i=1;i<m;i++){
dp[i][0]=0;
for(int j=1;j<k+1;j++){
dp[i][j]=pre[i][1]+dp[i-1][j-1];
dp[i][j]=max(dp[i][j],dp[i-1][j]+pre[i][0]);
/*if(j<=k-m){
cout<<i<<","<<j<<","<<dp[i][j]<<endl;
}*/
dp[i][j]=max(dp[i][j],dp[i][j-1]);
}
}
cout<<ans+dp[m-1][k-m];
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |