
状压dp
untilyouydc
月份未到你也得接受
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Hyperspace HDU - 4666 (最远曼哈顿距离模板题)
The great Mr.Smith has invented a hyperspace particle generator. The device is very powerful. The device can generate a hyperspace. In the hyperspace, particle may appear and disappear randomly. At th...原创 2018-09-03 20:08:31 · 279 阅读 · 0 评论 -
Rectangles POJ - 3695(离线+容斥+状压)
You are developing a software for painting rectangles on the screen. The software supports drawing several rectangles and filling some of them with a color different from the color of the background. ...原创 2018-08-30 14:36:06 · 246 阅读 · 0 评论 -
CSGO HDU - 6435(7维曼哈顿距离+加减符号枚举)
You are playing CSGO. There are n Main Weapons and m Secondary Weapons in CSGO. You can only choose one Main Weapon and one Secondary Weapon. For each weapon, it has a composite score S. The higher ...原创 2018-08-22 20:53:16 · 880 阅读 · 0 评论 -
简单的游戏(10进制轮廓线dp)
题目:思路:考虑按顺序进行填充,当前位置只受上一个影响和左边的一个影响。假设有5列,那么每一列用一个数来填充,最大是99999,最小是00000.由于m<=6,所以最大状态是999999,可以直接从0开始枚举,到999999复杂度为1e6。dp[sta][cur] 表示当状态为sta时的方案数,由于当前状态由前一个状态转移过来,所以cur只需要0或1就行。思路和普通的...原创 2018-11-26 20:47:55 · 205 阅读 · 0 评论 -
Doing Homework HDU - 1074 (状压dp确定最佳分配顺序)
题意:要求排出扣分最小的顺序,如果有多个,则按字典序最小输出。思路:用二进制状压表示有没有选,考虑从小到大进行更新,也就是说先确定做一个作业的最小扣分,再继续更新到做两个作业的最小扣分.....这样最后求(1<<n)-1的值,就是最小的扣分。状态转移,枚举最后一个加入的作业即可,也就是说当前作业完成情况是sta,最后一个选的是i,那么前一个状态应该是sta-(1<<...原创 2018-11-07 20:13:28 · 226 阅读 · 0 评论 -
方格取数(1) HDU - 1565(状压dp)
思路先暴力找出满足没有相邻1的的二进制状态。预处理出第i行,状态为k是能得到的值。最后依次递推到第n行即可。代码#include <bits/stdc++.h>using namespace std;typedef long long ll;int n;ll dp[20][20000];int a[21][21];int sta[20000];int cnt;...原创 2018-09-20 00:01:05 · 258 阅读 · 0 评论 -
POJ 2686 Traveling by Stagecoach (状压DP)
DescriptionOnce upon a time, there was a traveler. He plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in...原创 2018-08-17 19:53:37 · 196 阅读 · 0 评论 -
F - Shopping Offers POJ - 1170 (状压+背包)
In a shop each kind of product has a price. For example, the price of a flower is 2 ICU (Informatics Currency Units) and the price of a vase is 5 ICU. In order to attract more customers, the shop intr...原创 2018-08-17 18:40:18 · 332 阅读 · 0 评论 -
Mondriaan's Dream POJ - 2411 (建模型状压dp)
Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he had to use his toilet paper to draw on, for all of h...原创 2018-08-16 23:40:44 · 224 阅读 · 0 评论 -
Islands and Bridges POJ - 2288 (状压dp)
Given a map of islands and bridges that connect these islands, a Hamilton path, as we all know, is a path along the bridges such that it visits each island exactly once. On our map, there is also a po...原创 2018-08-16 20:54:56 · 186 阅读 · 0 评论 -
DNA Laboratory POJ - 1795 (状压dp+dfs)
Background Having started to build his own DNA lab just recently, the evil doctor Frankenstein is not quite up to date yet. He wants to extract his DNA, enhance it somewhat and clone himself. He has ...原创 2018-08-19 12:03:57 · 341 阅读 · 0 评论 -
Hie with the Pie POJ - 3311 (状压dp+最短路)
The Pizazz Pizzeria prides itself in delivering pizzas to its customers as fast as possible. Unfortunately, due to cutbacks, they can afford to hire only one driver to do the deliveries. He will wait ...原创 2018-08-16 16:35:15 · 221 阅读 · 0 评论 -
炮兵阵地 POJ - 1185(状压dp+位运算)
司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也可能是平原(用"P"表示),如下图。在每一格平原地形上最多可以布置一支炮兵部队(山地上不能够部署炮兵部队);一支炮兵部队在地图上的攻击范围如图中黑色区域所示: 如果在地图中的灰色所标识的平原上部署一支炮兵部队,则图中的黑色的网格表示它能够攻击到的区域:沿横...原创 2018-08-16 15:16:25 · 585 阅读 · 0 评论 -
Corn Fields POJ - 3254(状压dp入门)
Farmer John has purchased a lush new rectangular pasture composed of M by N (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) square parcels. He wants to grow some yummy corn for the cows on a number of squares. Regrettably, ...原创 2018-08-16 13:19:47 · 226 阅读 · 0 评论 -
Rectangular Covering POJ - 2836(状压dp)
n points are given on the Cartesian plane. Now you have to use some rectangles whose sides are parallel to the axes to cover them. Every point must be covered. And a point can be covered by several re...原创 2018-08-18 12:50:50 · 187 阅读 · 0 评论 -
Arrange the Bulls POJ - 2441 (状压dp+滚动数组)
Farmer Johnson's Bulls love playing basketball very much. But none of them would like to play basketball with the other bulls because they believe that the others are all very weak. Farmer Johnson has...原创 2018-08-17 21:13:21 · 178 阅读 · 0 评论