Lightoj 1019 - Brush (V)】的更多相关文章

算出从点1到点n的最短路径. /* *********************************************** Author :guanjun Created Time :2016/6/23 22:58:19 File Name :1019.cpp ************************************************ */ #include <iostream> #include <cstring> #include <cstd…
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1019 题目大意:Tanvir想从节点1的位置走到节点n的位置, 输出最短距离, 如果不存在输出"Impossible". 解题思路:dijkstra模版题 代码如下: #include<bits/stdc++.h> using namespace std; typedef long long LL; const int INF = 0x3f3f3f3f;…
After the long contest, Samee returned home 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 brush in his room which has width w. Dusts are defined as…
裸的最短路 dijkstra #include<cstdio> #include<string> #include<cstring> #include<iostream> using namespace std; const int MAXN = 101; const int INF = 0x3f3f3f3f; int dist[MAXN], vis[MAXN], mat[MAXN][MAXN]; int main(){ int t, u, v, w, n,…
题目链接: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…
题目链接: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…
1017 - Brush (III)    PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB Samir 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?…
1019 - Brush (V) PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB Tanvir 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? Aft…