Sshenyyyu @ 2018-10-31 21:07:12
#include <cstdio>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
#define ll long long
#define ull unsigned long long
const int Maxn=100001;
const int inf=2147483647;
ll n,m,T;
ll f[Maxn];
struct node { ll a,b,c; }p[Maxn];
bool cmp(node a,node b) {
return a.c*b.b<=b.c*a.b;
}
ll ma(ll a,ll b) { return a>b?a:b; }
int main() {
scanf("%lld%lld",&T,&n);
for(ll i=1; i<=n; i++) scanf("%lld",&p[i].a);
for(ll i=1; i<=n; i++) scanf("%lld",&p[i].b);
for(ll i=1; i<=n; i++) scanf("%lld",&p[i].c);
sort(p+1,p+n+1,cmp);
f[0]=0;
for(ll i=1; i<=n; i++)
for(ll j=T; j>=p[i].c; j--)
f[j]=max(f[j],f[j-p[i].c]+p[i].a-(j*p[i].b));
ll ans=0;
for(ll i=1; i<=T; i++)
ans=ma(ans,f[i]);
printf("%lld\n",ans);
return 0;
}
by Sshenyyyu @ 2018-10-31 22:14:12
@繁星灬夏若離 呃
by Sshenyyyu @ 2018-10-31 22:14:41
楼上的楼上是我npy
by Sshenyyyu @ 2018-10-31 22:17:13
@wang_tian_yi 你个硫硼
by Limerick @ 2018-10-31 22:17:22
@繁星灬夏若離
没毛病
by Limerick @ 2018-10-31 22:17:40
@Fitzwilliam_Darcy
兰州烧饼
by Limerick @ 2018-10-31 22:17:59
@繁星灬夏若離
有魔力的题目
by Sshenyyyu @ 2018-10-31 22:18:31
@wang_tian_yi 你这个害羞的蜜蜂
by Sshenyyyu @ 2018-10-31 22:19:00
@wang_tian_yi 你不要老是@xyy好不好
by Limerick @ 2018-10-31 22:19:09
@Fitzwilliam_Darcy Shy Bee
by Sshenyyyu @ 2018-10-31 22:19:18
@Fitzwilliam_Darcy 你这个ws的人