题目链接:点击打开链接
题目大意:一个矩形由n个小矩形组成,现在要给小矩形染色,但是颜料会向下滑,为了防止弄乱颜料,所以要先染上面的矩形,后然染下面的矩形,每一次改变颜色都要用一个新的刷子,问最小用多少刷子。
按照染色的条件,可以找到一个拓扑序列,拓扑序列中前面的要先染,后面的要后染,按拓扑的顺序dfs找出最少的刷字数。
#include
#include
#include
#incl...
分类:
其他好文 时间:
2015-07-20 14:29:06
阅读次数:
103
题目大意:要将一个大矩形內的所有小矩形涂色,涂色要求,只有该矩形上面的所有矩形都涂色了才可以涂该颜色,换一种填涂的颜色就要花费一点体力值,问填涂完需要花费的最小体力值解题思路:先处理一下填涂该矩形的前提条件,我用了一个can数组表示填涂该矩形时要满足的状态量
用dp[color][state]表示当前用的颜色是color,填涂的状态为state时所用的最少体力值
然后暴力得出转换和结果#incl...
分类:
其他好文 时间:
2015-07-18 17:06:05
阅读次数:
143
There arenpiles of pebbles on the table, thei-th pile containsaipebbles. Your task is to paint each pebble using one of thekgiven colors so that for e...
分类:
其他好文 时间:
2015-07-16 22:09:50
阅读次数:
155
【题目链接】:click here~~
【题目大意】:题意:你面前有宽度为1,高度给定的连续木板,每次可以刷一横排或一竖列,问你至少需要刷几次。
Sample Input
Input
5
2 2 1 2 1
Output
3
Input
2
2 2
Output
2
Input
1
5...
分类:
其他好文 时间:
2015-07-14 18:04:14
阅读次数:
129
B - Count the Colors
Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld
& %llu
Submit Status
Description
Painting some colored segments on a line, some previously pain...
分类:
其他好文 时间:
2015-07-08 22:42:09
阅读次数:
186
Annoying painting tool
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 1736
Accepted: 1165
Description
Maybe you wonder what an annoying painting tool is? ...
分类:
其他好文 时间:
2015-05-20 11:26:03
阅读次数:
91
Cube paintingWe have a machine for painting cubes. It is supplied with three different colors: blue, red and green. Each face of the cube gets one of ...
分类:
其他好文 时间:
2015-05-19 12:53:48
阅读次数:
133
Painting A Board
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 3471
Accepted: 1723
Description
The CE digital company has built an Automatic Painting Machi...
分类:
其他好文 时间:
2015-05-18 14:45:50
阅读次数:
158
给一个全0矩阵,每次你可以使得一个r*c的子矩阵01翻转,问是否可以通过这种操作使得矩阵变为题目给定的矩阵,最少需要多少次操作。
可以发现,对于第一行第一个点,它只能通过翻转包含(1,1)这个点在内的矩阵才能变,也就是r*c的左上端点在(1,1)。
通过至多一次操作,我们可以保证这个点可以达到目标状态。
接着第二个点,我们首先不能影响第一个点,因此如果这个点与目标状态不同,我们只能以这个点为...
分类:
其他好文 时间:
2015-05-02 22:07:17
阅读次数:
188
We have a machine for painting cubes. It is supplied with three different colors: blue, red and green. Each face of the cube gets one of these colors....
分类:
其他好文 时间:
2015-04-26 15:04:55
阅读次数:
142