bzoj 2073: [POI2004]PRZ
2073: [POI2004]PRZ
Description
Input
Output
Sample Input
24 60
10 40
18 50
Sample Output
#include<stdio.h>
#include<iostream>
using namespace std;
int w,n,i,j,a[],b[],f[<<],s[<<],c[<<];
int main()
{
scanf("%d%d",&w,&n);
for(i=;i<=n;i++)
scanf("%d%d",&a[i],&b[i]);
for(i=;i<=(<<n)-;i++)
{
for(j=;(<<j)<=i;j++)
if(<<j&i)
{
s[i]+=b[j+];
c[i]=max(c[i],a[j+]);
}
}
f[]=;
for(i=;i<=(<<n)-;i++)
{
if(s[i]<=w) f[i]=c[i];else f[i]=;
for(j=(i-)&i;j>;j=(j-)&i)
if(s[i^j]<=w) f[i]=min(f[i],f[j]+c[i^j]);
}
cout<<f[(<<n)-];
return ;
}
bzoj 2073: [POI2004]PRZ的更多相关文章
- BZOJ 2073: [POI2004]PRZ( 状压dp )
早上这道题没调完就去玩NOI网络同步赛了.... 状压dp , dp( s ) 表示 s 状态下所用的最短时间 , 转移就直接暴力枚举子集 . 可以先预处理出每个状态下的重量和时间的信息 . 复杂度是 ...
- Bzoj: 2073 [POI2004]PRZ 题解
2073: [POI2004]PRZ Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 401 Solved: 296[Submit][Status][D ...
- BZOJ 2073 [POI2004]PRZ(状压DP)
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=2073 [题目大意] 任何时候队伍在桥上的人都不能超过一定的限制. 所以这只队伍过桥时只 ...
- BZOJ 2073: [POI2004]PRZ [DP 状压]
传送门 水题不解释 这道题的主要目的在于记录一个枚举子集的技巧 #include <iostream> #include <cstdio> #include <cstri ...
- 2073: [POI2004]PRZ
2073: [POI2004]PRZ Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 284 Solved: 213[Submit][Status][D ...
- bzoj 2073 暴力
2073: [POI2004]PRZ Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 442 Solved: 327[Submit][Status][D ...
- 【BZOJ2073】[POI2004]PRZ 状压DP
[BZOJ2073][POI2004]PRZ Description 一只队伍在爬山时碰到了雪崩,他们在逃跑时遇到了一座桥,他们要尽快的过桥. 桥已经很旧了, 所以它不能承受太重的东西. 任何时候队伍 ...
- BZOJ [POI2004]PRZ 状压DP_二进制_骚操作
二进制就是比谁更sao... Code: #include <bits/stdc++.h> #define setIO(s) freopen(s".in"," ...
- BZOJ2073: [POI2004]PRZ
题目:http://www.lydsy.com/JudgeOnline/problem.php?id=2073 题解:跟风Xs酱! 数据范围这么小,肯定是状压DP.咦?怎么枚举子集?... 跪烂Xs: ...
随机推荐
- windows7_常用操作终端操作
查看环境变量:set 添加环境变量:set aa = 88 删除环境变量:set aa = 查看ip配置:ipconfig 查看全局环境变量配置:path 查看当前目录文件:dir 进入E盘:E: 进 ...
- Python 对象模型 -- (转)
面向对象的纯粹性 在很久很久以前,C++还被称为面向对象语言(现在一般称为多范式通用语言),人们就对C++的面向对象的纯粹性提出了质疑,主要有以下几点: 并非所有的对象都是对象(很拗口?),比如指针本 ...
- Python模块学习 - openpyxl
openpyxl模块介绍 openpyxl模块是一个读写Excel 2010文档的Python库,如果要处理更早格式的Excel文档,需要用到额外的库,openpyxl是一个比较综合的工具,能够同时读 ...
- Ubuntu 14.04 ThinkPad E431无线网卡驱动安装
Ubuntu 14.04下安装无线网卡驱动. sudo apt-get install linux-headers-generic build-essential dkms sudo apt-get ...
- jQuery Validate插件 验证实例
官网地址:http://bassistance.de/jquery-plugins/jquery-plugin-validation Validate手册: http://www.cnblogs.co ...
- 斯坦福开源无Bug的随机计算图Certigrad
斯坦福开源无Bug的随机计算图Certigrad https://news.cnblogs.com/n/573690/ ttps://github.com/dselsam/certigrad
- sicily 1020. Big Integer
Description Long long ago, there was a super computer that could deal with VeryLongIntegers(no VeryL ...
- 包装类、基本数据类型及String类之间的相互转换
包装类:8种基本数据类型对应一个类,此类即为包装类 一.基本数据类型 包装类 及String之间的转换 1.基本数据类型转化为包装类:调用包装类的构造器 int i=10; Inte ...
- Linux 日志系统及分析
简介 在Centos 7.x / RHEL 7.x 的版本,系统日志是由一个名为 rsyslog的服务管理的,默认的日志守护进程为 rsyslog , rsyslog 是 syslog 的升级版本,默 ...
- Github精选 – 适合移动端的HTML5 Datepicker
2016-01-12 (updated: 2017-01-07) 15731 通过 HTML5 的 <input> 新属性可以简单方便地调用手机的原生 Datepicker,但功能较弱, ...