摘要: tarjan + topsort(就是个DAG上的dp) cpp include include include using namespace std; int price[100010]; struct node { int point; int nxt; }; node l1[1000010] 阅读全文
posted @ 2018-03-27 19:13 Lance1ot 阅读(131) 评论(0) 推荐(0) 编辑
摘要: "题目" 真可以,我昨天写的全不对。今天写的一次ac 就是二分答案+spfa 阅读全文
posted @ 2018-03-27 19:09 Lance1ot 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 对于边权都为相同的图,求最短路可以用bfs "题目" cpp include include include include using namespace std; struct node { int point; int nxt; }; node line[4000100]; int head[ 阅读全文
posted @ 2018-03-27 18:15 Lance1ot 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 能看出来是多源最短路。只能用floyed。 但是这道题确实加深了我对floyed的理解 "题目" 阅读全文
posted @ 2018-03-27 18:12 Lance1ot 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 结构体 区间重叠问题 (以区间数最多为例,左右端点重合也算重叠) 区间(全)覆盖 阅读全文
posted @ 2018-03-25 16:03 Lance1ot 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 并查集的题 关于带有多个相对集合的全集,我们可以多开几倍的空间。每一倍的元素表示这个当前里的相对元素 肯定有一些自恃NB的不会看的 阅读全文
posted @ 2018-03-25 11:49 Lance1ot 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 并查集维护集合 这道题code写起来很容易 但有很多启示 这道题需要逆序做 为什么呢? 对于路径压缩的并查集来说,如果合并了。那么想要在分开是很难的。 而且这道题要求每步输出。但是!! 这道题是先给操作,再统一输出!! 我们就可以离线做 那么我们就可以逆序做 先处理最后的状态,然后倒着合并。这样的话 阅读全文
posted @ 2018-03-25 09:00 Lance1ot 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 我好蒟蒻呀 连区间覆盖这个贪心都不会 我的写法好水呀 启示:要转化问题 cpp include include include include include using namespace std; queue q; bool visit[510][510]; int dx[5]={1, 1,0, 阅读全文
posted @ 2018-03-24 21:17 Lance1ot 阅读(95) 评论(0) 推荐(0) 编辑
摘要: spfa判负环 如果一个点在spfa中被入队了大于n次 那么,我们就能肯定,有负环出现。 因为一个点入队时,他肯定被更新了一次。 所以........ 如果不存在负权环。这个点最多被更新节点数次 我们就可以利用这个性质判负环 ~~亏我dijk写了一上午~~ "题目" 语文模板题 cpp includ 阅读全文
posted @ 2018-03-24 15:26 Lance1ot 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 哈哈哈 终于过了 这个题 tarjan + topsort +一点小dp 缩完点后再DAG上跑dp~~特别水的~~ 然而我确实傻乎乎的写爆炸里 还是码力不够的事呀 的确 在DAG上跑DP 是需要判断各个点和起点之间的关系的 而且输出方案时 也需要特别注意 cpp include include in 阅读全文
posted @ 2018-03-23 19:46 Lance1ot 阅读(94) 评论(0) 推荐(0) 编辑