BZOJ 5441: [Ceoi2018]Cloud computing
背包
#include<cstdio>
#include<algorithm>
using namespace std;
int n,m,Len;
long long F[2][100005];
struct node{
int c,f,v;
}E[100005];
bool cmp(node a,node b){
return a.f>b.f || (a.f==b.f && a.c>b.c);
}
int main(){
scanf("%d",&n);
for (int i=1; i<=n; i++) scanf("%d%d%d",&E[i].c,&E[i].f,&E[i].v);
for (int i=1; i<=n; i++) E[i].v=-E[i].v;
scanf("%d",&m);
for (int i=1; i<=m; i++) scanf("%d%d%d",&E[i+n].c,&E[i+n].f,&E[i+n].v);
for (int i=1; i<=m; i++) E[i+n].c=-E[i+n].c;
Len=n+m;
sort(E+1,E+Len+1,cmp);
int Max=0;
for (int i=0; i<Len; i++){
int tomax=Max;
if (E[i+1].c>0) tomax+=E[i+1].c;
for (int j=0; j<=Max; j++) F[(i+1)%2][j]=F[i%2][j];
for (int j=Max+1; j<=tomax; j++) F[(i+1)%2][j]=-1ll<<60;
for (int j=0; j<=Max; j++)
if (j+E[i+1].c>=0) F[(i+1)%2][j+E[i+1].c]=max(F[(i+1)%2][j+E[i+1].c],F[i%2][j]+E[i+1].v);
Max=tomax;
}
long long ans=0;
for (int i=0; i<=Max; i++) ans=max(ans,F[Len%2][i]);
printf("%lld\n",ans);
return 0;
}
BZOJ 5441: [Ceoi2018]Cloud computing的更多相关文章
- bzoj5441: [Ceoi2018]Cloud computing
跟着大佬做题.. 这题也是有够神仙了.观察一下性质,c很小而f是一个限制条件(然而我并不会心态爆炸) %了一发,就是把电脑和订单一起做背包,订单的c视为负而电脑的v为负,f由大到小排序做背包 #inc ...
- what's cloud computing? IaaS
Cloud computing has changed the ITC industry. Companies like Amazon, Google and Microsoft have built ...
- cloud theory is a failure? 分类: Cloud Computing 2013-12-26 06:52 269人阅读 评论(0) 收藏
since LTE came out, with thin client cloud computing and broadband communication clouding 不攻自破了.but ...
- 云计算中心网络资源分配-Faircloud: sharing the network in cloud computing
网络资源同计算资源以及存储资源一样,是一种可被租户共享使用并提高利用率的资源.但是,不同租户的计算资源以及存储资源之间,有很强的隔离性,可以实现按需按比例分配的使用方式,但是网络资源却不可以. 主要原 ...
- How does java technology relate to cloud computing?
Java Paas shootout (@IBM developer) Cloud computing is always a hot topic around IT field today.Ho ...
- Cloud Computing Deployment Models
Cloud computing can broadly be broken down into three main categories based on the deployment model. ...
- 学习笔记之Cloud computing
Cloud computing - Wikipedia https://en.wikipedia.org/wiki/Cloud_computing
- Cloud Computing Causing Digital Business Transformation
2015-04-13 Cloud Computing Causing Digital Business Transformation We hear all about the cloud, and ...
- Cloud Computing
More numbers, More power. We waste much more every day. Everything can be connectible through specia ...
随机推荐
- 天上掉馅饼 期望DP
C 天上掉馅饼文件名 输入文件 输出文件 时间限制 空间限制bonus.pas/c/cpp bonus.in bonus.out 1s 128MB题目描述小 G 进入了一个神奇的世界,在这个世界,天上 ...
- 基于JAVA的设计模式之适配器模式
适配器模式概念 适配器模式把一个类的接口变换成客户端所期待的另一个接口,从而使原本因接口不匹配而无法在一起工作的两个类能够在一起工作.比如我们突然就想看电影了,但是这个电影是AVI格式的,目前我们开发 ...
- vue-cli 该如何正确打包iconfont?
其实这种问题应该问google的: got wrong bootstrap font path after building · Issue #166 · vuejs-templates/webpac ...
- js获取当前的年月日时分秒周期
function timeNow(){ var date = new Date(); this.year = date.getFullYear(); this.month = date.getMont ...
- jquery解析xml,获取xml标签名
先给一个简单的XML,结构如下 <?xml version="1.0" encoding="uft-8" ?> <msg> <ro ...
- allure使用简介
#安装依赖包pip install requests_toolbeltpip install pyyamlpip install pytest-allure-adaptor #安装allure2 说明 ...
- MySQL数据库详解(三)MySQL的事务隔离剖析
提到事务,你肯定不陌生,和数据库打交道的时候,我们总是会用到事务.最经典的例子就是转账,你要给朋友小王转 100 块钱,而此时你的银行卡只有 100 块钱. 转账过程具体到程序里会有一系列的操作,比如 ...
- 苹果ATS Win2008 R2 IIS7.5 HTTPS 证书的那些可能遇到的坑
前言:工作这么多年,每一次要弄https 都和苹果有关,上一次是苹果app的企业安装形式,ios7后 .plist 文件必须在一个https路径. 这一次则是苹果的ATS计划,无疑这是在推动网络安全上 ...
- python_102_属性方法
# 属性方法:把一个方法变成一个静态属性 #1 class Dog(object): def __init__(self,name): self.name=name @property#属性 def ...
- Ajax的原理及Django上传组件
title: Ajax的原理及Django上传组件 tags: Django --- Ajax的原理及Django上传组件 Ajax的原理 ajax 是异步JavaScript和xml ajax就是向 ...