随笔分类 -  贪心

摘要:http://uoj.ac/problem/455 题解: https://blog.csdn.net/litble/article/details/88410435 https://www.mina.moe/archives/11762 以下是我瞎bb的: 如果我没看错的话,这个模拟费用流模拟的根 阅读全文
posted @ 2019-04-16 11:54 hehe_54321 阅读(696) 评论(0) 推荐(1)
该文被密码保护。
posted @ 2019-03-18 19:43 hehe_54321 阅读(8) 评论(0) 推荐(0)
摘要:loj2734 洛谷P3615 http://218.5.5.242:9021/problem/185 不会做... 题解(来自ditoly): 这一步更详细的解释(来自kkksc03): 还是从后面推。我们把女性设为+1,男性设为-1,然后从队伍末尾开始开始计算后缀和。一但后缀和到了-2,就说明到 阅读全文
posted @ 2019-02-21 21:34 hehe_54321 阅读(694) 评论(0) 推荐(0)
摘要:洛谷P5021 http://210.33.19.103/contest/1050/problem/3 http://210.33.19.103/contest/1054/problem/3 multiset版本(TLE) 1 #include<cstdio> 2 #include<algorith 阅读全文
posted @ 2018-11-17 10:33 hehe_54321 阅读(270) 评论(0) 推荐(0)
摘要:洛谷P2514 bzoj2426 其实是个简单的贪心,然而不适合在脑子不清醒的时候做...看不懂题意续了1个小时 很容易发现应该枚举新建哪个发电厂,对于这种方案就是取其中b吨煤运到原来发电厂,取剩下(suma-b)吨煤运到新发电厂。首先假设全部都运到原来发电厂,然后把其中suma-b吨代价最小的改为 阅读全文
posted @ 2018-11-04 21:06 hehe_54321 阅读(159) 评论(0) 推荐(0)
摘要:bzoj1045 洛谷P4016 洛谷P2512 bzoj3293 洛谷P3156 题解:https://www.luogu.org/blog/LittleRewriter/solution-p2512 1 #include<cstdio> 2 #include<algorithm> 3 #incl 阅读全文
posted @ 2018-11-04 19:13 hehe_54321 阅读(173) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2018-11-03 22:20 hehe_54321 阅读(5) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2018-11-01 18:31 hehe_54321 阅读(2) 评论(0) 推荐(0)
摘要:题面: https://www.luogu.org/problemnew/show/P3462 https://www.lydsy.com/JudgeOnline/problem.php?id=1110 https://szkopul.edu.pl/problemset/problem/y7tXjq 阅读全文
posted @ 2018-10-31 11:41 hehe_54321 阅读(242) 评论(0) 推荐(0)
摘要:https://www.luogu.org/problemnew/show/P1121 不会做啊。。。 看题解讲的: 答案的两段可能有两种情况:一是同时包含第1和第n个,2是不同时包含第1和第n个 对于第二种可以先求出f[i],g[i]分别表示1..i和i..n的最大子段和,然后枚举断点解决 对于第 阅读全文
posted @ 2018-10-28 15:36 hehe_54321 阅读(223) 评论(0) 推荐(0)
摘要:https://www.luogu.org/problemnew/show/P2376 看了题解做的,根本不会贪心。。 1 #include<cstdio> 2 #include<algorithm> 3 #include<cstring> 4 #include<vector> 5 using na 阅读全文
posted @ 2018-10-19 16:17 hehe_54321 阅读(204) 评论(0) 推荐(0)
摘要:https://codeforces.com/contest/958/problem/B2 题解:https://www.cnblogs.com/Cool-Angel/p/8862649.html upd2018-11-01: 修了一个bug(第60行加入inq[1]=1) 1 #include<c 阅读全文
posted @ 2018-09-26 13:35 hehe_54321 阅读(269) 评论(0) 推荐(0)
摘要:原题:https://cn.vjudge.net/problem/TopCoder-14812 http://210.33.19.103/contest/1002/problem/4 树上的石头 时间:1s 空间:256M 题目描述: 给你一棵树,标号为0到n-1,0为根节点,每个点有点权 现在你可 阅读全文
posted @ 2018-09-21 15:06 hehe_54321 阅读(230) 评论(0) 推荐(1)
摘要:https://codeforces.com/contest/958/problem/E2 首先求出N个时刻的N-1个间隔长度,问题就相当于在这些间隔中选K个数,相邻两个不能同时选,要求和最小 方法1: 一个K^2的做法,有一定技巧 https://www.cnblogs.com/void-f/p/ 阅读全文
posted @ 2018-09-21 07:48 hehe_54321 阅读(357) 评论(0) 推荐(0)
摘要:网上的题解都很奇怪。。 经过相当长时间的思考,有了一个有效(自认为)的解法 设某一种合法分配方案完成后三个数分别变为a,b,c,其中a>=c,b>=c 此时如果让c减1,让a或b加1(设让t加了1),那么答案增加的值为2t+1-2c+1-7=2t-2c-5 令其>0,则t-c>2.5 由于t,c是整 阅读全文
posted @ 2018-08-26 18:39 hehe_54321 阅读(219) 评论(0) 推荐(0)
摘要:根本不会。。。 http://codevs.cn/problem/3008/ 题解: https://www.cnblogs.com/f91og/p/6024706.html https://blog.csdn.net/liufeng_king/article/details/8678316 htt 阅读全文
posted @ 2018-08-03 14:13 hehe_54321 阅读(178) 评论(0) 推荐(0)
摘要:https://www.luogu.org/problemnew/show/P1954 拓扑排序, 注意到如果正着建图("a出现早于b"=>"a向b连边"),贪心选择,可能前面某一次的选择造成后面找不出合法方案; 但是如果反过来建图,而且每一次选择当前入度为0的点中K值最大的,那么一定不会产生前面那 阅读全文
posted @ 2018-08-02 21:16 hehe_54321 阅读(292) 评论(0) 推荐(0)
摘要:https://codeforces.com/contest/965/problem/D 太神仙了。。。比E难啊。。 首先呢,根据题意,可以很容易的建出一个最大流模型 就是每个位置建一条边,容量限制为该位置石头数,向所有它能直接跳到的位置的边的起点连边(容量无限) (当然起点和对岸也要分别建一条边, 阅读全文
posted @ 2018-07-31 11:00 hehe_54321 阅读(241) 评论(0) 推荐(0)
摘要:https://codeforces.com/contest/680/problem/D 一道2D,又是搞两个小时才搞出来。。。不过好在搞出来了 官方题解:可以证明对于m,设a是满足a^3<=m的最大a,那么选a或a-1一定最优;那么可以暴力dfs ....23333.。。。。。 完了,我也不知道为 阅读全文
posted @ 2018-07-29 21:59 hehe_54321 阅读(193) 评论(0) 推荐(0)
摘要:http://codeforces.com/problemset/problem/916/B 好尬啊。。。 阅读全文
posted @ 2018-07-09 20:53 hehe_54321 阅读(139) 评论(0) 推荐(0)

AmazingCounters.com