Lightoj 1018 - Brush (IV)】的更多相关文章

1018 - Brush (IV)    PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB Mubashwir returned home from the contest and got angry after seeing his room dusty. Who likes to see a dusty room after a brain storming programming conte…
题目链接:http://lightoj.com/volume_showproblem.php? problem=1018 题意分析:平面上有不超过N个点,如今能够随意方向划直线将它们划去,问:最少要划几次能够把全部的点划去? 解题思路:我们能够使用集合S表示:有哪些点还没有被划掉,然后转移 dp[s] = min(dp[s &(~line[i][j])]) + 1;这里涉及到line[i][j]的处理,它代表的是在i点和j点构成的直线上一共同拥有几个点,须要预先处理. 边界条件就是S中集合元素…
1018 - Brush (IV)    PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB Mubashwir returned home from the contest and got angry after seeing his room dusty. Who likes to see a dusty room after a brain storming programming conte…
题目大意:     一个二维平面上有N个点,一把刷子,刷一次可以把一条线上的所有点都刷掉.问最少刷多少次,可以把全部的点都刷完 状态压缩DP, 用记忆化搜索来写, 需要有个优化不然会超时. ========================================================================================   #include<cstdio> #include<cstring> #include<iostream&g…
题目大意: 给出n个点的坐标,求至少画多少掉直线才能连接所有点. 题目思路:状态压缩 首先经行预处理,求出所有状态下,那些点不在该状态内 以任意两点为端点求出这条直线的状态 枚举所有状态,找出不在当前状态下的两点,以这两点所形成的直线经行更新dp. 其中dp[i]表示在i状态下的最优解. #include<cstdio> #include<cstring> #include<cmath> #include<iostream> #include<vect…
题意:平面上有一些点,每刷一次可以把同一条直线上的点都刷光,问最少几次把所有点刷光. 方法: 显然是一个状态压缩dp.ans[S]表示把S集合中点刷掉的最少次数.最开始想到的方法是如果S中只有一个或两个点,那么ans[S]=1.否则枚举S中任意两点i,j作为直线上的点,并算出经过i,j的直线还过S中其他多少个点,那么ans[S]=min(ans[S],ans[S去掉那条直线经过的所有点]+1).自然而然的就想到应该预处理出过i,j两点的直线过的其他点的集合,只需要枚举i,j和另外一个点再判是否共…
http://www.lightoj.com/volume_showproblem.php?problem=1018   Mubashwir returned home from the contest and got angry after seeing his room dusty. Who likes to see a dusty room after a brain storming programming contest? After checking a bit he found a…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1018 #include <cstdio> #include <cstring> #include <iostream> #include <cmath> #include <algorithm> #include <queue> #include <vector> using namespace std; ;…
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1017 搞了一个下午才弄出来,,,,, 还是线性DP做的不够啊 看过数据量就知道状态转移方程和x,没有关系 然后再仔细推导就会知道整个转移方程只和k与y的差值有关 然后继续推导.... 定义dp[i][j]表示表示第j步删除最上边的i点, 定义mv[i]表示删除i点的同时可以向下移动的最远位置(可以预处理出来) 那么dp[i][j]=max(dp[i-1][j],dp[i-mv…
http://www.lightoj.com/volume_showproblem.php?problem=1017 题意:给出刷子的宽和最多横扫次数,问被扫除最多的点是多少个. 思路:状态设计DP[i][j]代表刷子下边界为i已用了j次时最大个数.决策为扫和跳过. /** @Date : 2016-12-18 14:25:51 * @FileName: LightOJ 1017 DP?.cpp * @Platform: Windows * @Author : Lweleth (SoundEar…