POJ2411 铺地砖 Mondriaan's Dream】的更多相关文章

Mondriaan's Dream Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 15962   Accepted: 9237 Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series…
[POJ2411]Mondriaan's Dream(轮廓线DP) 题面 Vjudge 题解 这题我会大力状压!!! 时间复杂度大概是\(O(2^{2n}n^2)\),设\(f[i][S]\)表示当前第\(i\)行向下伸展出去的状态为\(S\) 那么每次枚举一下当前行的放法,进行转移就好了. 然后就长成了这个样子(不要在意我强行缩减代码长度) 尽管这不是我们本题的重点,然而我还是放份代码 #include<cstdio> #include<cstring> int n,m;long…
http://poj.org/problem?id=2411 (题目链接) 题意 一个$n*m$的网格,用$1*2$的方块填满有多少种方案. Solution 轮廓线dp板子.按格dp,对上方和左方的格子的占用情况进行讨论转移.0表示已放置,1表示未放置. 细节 LL,滚动清空数组. 代码 // poj2411 #include<algorithm> #include<iostream> #include<cstdlib> #include<cstring>…
AC传送门:http://vjudge.net/problem/POJ-2411 [题目大意] 有一个W行H列的广场,需要用1*2小砖铺盖,小砖之间互相不能重叠,问有多少种不同的铺法? [题解] 对于每一行有w个位置,所以每一行都有0-2w-1种状态. 对于当前行的状态s,它是由前一行的状态s'转化过来的,显然,对于该行某个位置j: 如果前一行该位置为0,那么该位置可以竖放 即 0-> 1 如果前一行连续两个位置为0,那么这两个连续位置可以横放 即00-> 00 如果前一行该位置为1,显然该位…
题目大意:给定一个 N*M 的棋盘,用 1*2 的木条填满有多少种不同的方式. 题解:在这里采用以行为阶段进行状压 dp.到第 i 行时,1*1 的木块分成两类,第一类是这个木块是竖着放置木条的上半部分,第二类是其他情况.对于第一种情况来说,第 i+1 行的状态只能是 0,而对于第二种情况来说,第 i+1 行没有特殊限制.因此,可以得出第一个状态转移的限制,即:上下两行之间的状态 (i,j) 转移需要满足 i&j==0.第二种情况是,如果 i|j==0,则意味着上下两行都是 0,上面可以是一个木…
Mondriaan's Dream Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 15295   Accepted: 8820 Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series…
Mondriaan's Dream Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 20822   Accepted: 11732 Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet serie…
Mondriaan's Dream Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 18096   Accepted: 10357 Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet serie…
炮兵阵地 Language:Default 炮兵阵地 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 34008 Accepted: 13083 Description 司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队.一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也可能是平原(用"P"表示),如下图.在每一格平原地形上最多可以布置一支炮兵部队(山地上不能够部署…
Mondriaan's Dream Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 17203   Accepted: 9918 Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series…
Mondriaan's Dream Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 13519   Accepted: 7876 Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series…
Mondriaan's Dream Problem Description 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 his paper was…
题目:Mondriaan's Dream 链接:http://poj.org/problem?id=2411 题意:用 1*2 的瓷砖去填 n*m 的地板,问有多少种填法. 思路: 很久很久以前便做过的一道题目,状压DP,当时写得估计挺艰辛的,今天搜插头DP又搜到它,就先用状压DP写了下,顺利多了,没一会就出来了,可惜因为long long没有1A. 思路挺简单,一行一行解决,每一列用1 表示对下一行有影响,用0 表示对下一行没有影响,所以一行最多2048 种可能,然后要筛选一下,因为有些本身就…
[poj P2411] Mondriaan's Dream Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 18023   Accepted: 10327 Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his '…
题目链接: http://poj.org/problem?id=2411 Mondriaan's Dream Time Limit: 3000MSMemory Limit: 65536K 问题描述 Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he had…
Mondriaan's Dream 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 his paper was filled with squares…
Mondriaan's Dream Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 18903 Accepted: 10779 Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (…
Mondriaan's Dream POJ - 2411 可以用状压dp,但是要打一下表.暴力枚举行.这一行的状态.上一行的状态,判断如果上一行的状态能转移到这一行的状态就转移. 状态定义:ans[i][S]表示i行前已经全部填满,i行已经填上的列为集合S.如果有竖着的,全部当做用这一行的去补满上一行缺的. (貌似还是插头dp的入门题) #include<cstdio> #include<cstring> typedef long long LL; LL f[][]; LL h,w…
Mondriaan's Dream Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 18903 Accepted: 10779 Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (…
Mondriaan's Dream Time Limit: 3000MS Memory Limit: 65536K Description 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 d…
PKU P2411 Mondriaan's Dream 题目描述: 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 his paper was fil…
Mondriaan's Dream 题目链接 Problem Description 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 his pape…
状压DP Description 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 his paper was filled with squares…
Description 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 his paper was filled with squares and r…
Description 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 his paper was filled with squares and r…
第一道轮廓线dp,因为不会轮廓线dp我们在南京区域赛的时候没有拿到银,可见知识点的欠缺是我薄弱的环节. 题目就是要你用1*2的多米诺骨排填充一个大小n*m(n,m<=11)的棋盘,问填满它有多少不同的方法. 一个可行的解法就是轮廓线dp. 假设我们从上往下,从左往右去填,那么我们会发现,假如我们当前填的是(i,j)格的时候,在它前面的(i',j')其实是已经确定一定填了的,所以实际上没有填的时候处于轮廓线的部分,在这里没有具体 1 1 1 1 1 1 x x x x             如上…
题目大意 给定一个N*M大小的地板,要求你用1*2大小的砖块把地板铺满,问你有多少种方案? 题解 刚开始时看的是挑战程序设计竞赛上的关于铺砖块问题的讲解,研究一两天楞是没明白它代码是怎么写的,智商捉急,上面是用逐格进行转移的,据说神马插头DP...坑爹啊...然后果断放弃研究了...我们还是逐行的进行转移,这样比较好理解,方程表示为:dp[i][j]+=dp[i-1][k](能够从上一行的状态k转移到当前状态j).我们需要枚举出符合要求的状态j和k,如果第i-1行p列没有放,那么第i行的p列肯定…
传送门 >Here< 题意:用1*2的砖块铺满n*m的地板有几种方案 思路分析 状压经典题! 我们以$f[i][j]$作为状态,表示第i行之前全部填完并且第i行状态为j(状压)时的方案数. 我们考虑,对于一个格子,一块砖有3种方法. (一):横着放.对下一行没有任何影响 (二):竖着放,并且当前这一格作为砖块的下层.那么对下一行也没有任何影响 (三):竖着放,并且当前这一格作为砖块的上层.这种情况对下一行很明显是有影响的. 综上,只有情况3是对下一行有影响的. 所以我们需要一种方法来区分前两种…
$11*11$格子板上铺$1*2$地砖方案.以前做过?权当复习算了,毕竟以前学都是浅尝辄止的..常规题,注意两个条件:上一行铺竖着的则这一行同一位一定要铺上竖的,这一行单独铺横的要求枚举集合中出现连续偶数个的1,预处理一下即可.注意数据及时reset. #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include…
这道题的解析这个博客写得很好 https://blog.csdn.net/shiwei408/article/details/8821853 大致意思就是我们可以只处理两行之间的关系,然后通过这两个关系推出所有行(有点像矩阵快速幂的思想) 几个要注意的地方 (1)第0行为全1 (2)发现自己的思维习惯还是先行在状态,我自己写得时候老是写反. (3)path的个数可能有很多,不只是1<<n,可以输入极限数据然后输出路径的数目作为数组空间大小 (4)拿小的作列 (5)这道题是人为的设置一种方式,使…