比赛 |
Asm.Def战记之圣地亚哥“杯2015 |
评测结果 |
WWWWWWWWWW |
题目名称 |
Asm.Def的枪榴弹 |
最终得分 |
0 |
用户昵称 |
pppoooiiizzy |
运行时间 |
0.002 s |
代码语言 |
C++ |
内存使用 |
0.31 MiB |
提交时间 |
2015-10-31 10:20:34 |
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
#include<vector>
#include<set>
#include<functional>
#include<string>
const int maxn = 20;
using namespace std;
#define rep(i, j, k) for(int i = j; i <= k; i++)
#define drep(i, j, k) for(int i = j; i >= k; i--)
#define INF 0x3fffffff
inline int read()
{
int x = 0, f = 1;
char ch = getchar();
while(ch < '0' || ch > '9') {if( ch == '-') f = -1; ch = getchar();}
while(ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
return x * f;
}
struct poi {
int ren, pao;
int jia, yi, bing;
int sum_enemy;
int sum_buji;
}boom[maxn];
int m, n, Ar, Sa, La, s, t, temp, cnt;
poi T[maxn];
bool cmp(const poi i, const poi j) {return i.sum_enemy < j.sum_enemy;}
int main()
{
freopen("asm_grenade.in", "r", stdin);
freopen("asm_grenade.out", "w", stdout);
ios::sync_with_stdio(false);
n = read();
rep(i, 1, n) cin>>boom[i].ren;
rep(i, 1, n) cin>>boom[i].pao;
rep(i, 1, n) cin>>boom[i].jia;
rep(i, 1, n) cin>>boom[i].yi;
rep(i, 1, n) cin>>boom[i].bing;
rep(i, 1, n) boom[i].sum_enemy = boom[i].ren + boom[i].pao;
rep(i, 1, n) boom[i].sum_buji = boom[i].jia + boom[i].yi + boom[i].bing;
cin>>Ar>>Sa>>La;
sort(boom + 1, boom + 1 + n, cmp);
//rep(i, 1, n) printf("%d %d %d %d %d\n", boom[i].ren, boom[i].pao, boom[i].jia, boom[i].yi, boom[i].bing);
rep(i, 1, n) {
if( boom[i].sum_buji < boom[i].sum_enemy) continue;
if( Ar + La >= boom[i].jia && Sa + La >= boom[i].yi && Ar + Sa + La >= boom[i].sum_enemy) {
Ar = Ar + boom[i].jia - boom[i].ren;
Sa = Sa + boom[i].yi - boom[i].pao;
if( Ar < 0 ) Ar = 0, La = La + boom[i].bing + boom[i].ren - boom[i].jia, boom[i].bing = 0;
if( Sa < 0 ) Sa = 0, La = La + boom[i].bing + boom[i].pao - boom[i].yi, boom[i].bing = 0;
}
else {
T[cnt].ren = boom[i].ren, T[cnt].pao = boom[i].pao, T[cnt].jia = boom[i].jia;
T[cnt].yi = boom[i].yi, T[cnt].bing = boom[i].bing;
T[cnt].sum_enemy = boom[i].sum_enemy;
cnt++;
}
}
rep(i, 0, cnt - 1) {
if( Ar + La >= T[i].jia && Sa + La >= T[i].yi && Ar + Sa + La >= T[i].sum_enemy) {
Ar = Ar + T[i].jia - T[i].ren;
Sa = Sa + T[i].yi - T[i].pao;
if( Ar <= 0 ) Ar = 0, La = La + T[i].bing + T[i].ren - T[i].jia, T[i].bing = 0;
if( Sa <= 0 ) Sa = 0, La = La + T[i].bing + T[i].pao - T[i].yi, T[i].bing = 0;
}
}
cout<<Ar + Sa + La + 3<<endl;
return 0;
}