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 21:45:44
@wang_tian_yi
by Limerick @ 2018-10-31 21:49:39
然而并不是
by Limerick @ 2018-10-31 21:50:52
return a.c*b.b<=b.c*a.b;
此处应为
return a.c*b.b<b.c*a.b;
并不是数组开小了的问题
@Fitzwilliam_Darcy
兰州烧饼
by AK_Automata @ 2018-10-31 21:56:16
@wang_tian_yi 你怎么又红名了。。。
by Limerick @ 2018-10-31 21:58:36
帮某位大佬改了一题代码然后就从蓝一下跳掉了红@AK_Automata
by AK_Automata @ 2018-10-31 22:01:43
哪道神奇的题目?@wang_tian_yi
by Limerick @ 2018-10-31 22:02:45
P4722 【模板】最大流 加强版 / 预流推进 @AK_Automata
by iwprc @ 2018-10-31 22:07:27
真神奇
by Limerick @ 2018-10-31 22:09:09
恭喜兰州成功炸出了一个大佬 @Fitzwilliam_Darcy
by 繁星灬夏若離 @ 2018-10-31 22:11:23
@wang_tian_yi
不会是wo神奇的程序吧qwq。。。我也是那题之后成功红名qwq...