摘要: "http://codevs.cn/problem/1288/" loli秘制面向高一的搜索,好难啊QAQ 我本来想按照分母从大到小搜,因为这样分母从小到大枚举到的第一个可行方案就是最优方案。 但貌似会T。。。 所以按照分母从小往大搜,分母得有个上界。 设分母为$num$,则$\frac{step} 阅读全文
posted @ 2016-11-16 18:33 abclzr 阅读(335) 评论(0) 推荐(0) 编辑
摘要: "http://www.lydsy.com/JudgeOnline/problem.php?id=4582" 排好序后用两个指针直接$O(n)$扫,貌似这个东西学名"two pointers"? c++ include include include include using namespace 阅读全文
posted @ 2016-11-16 14:51 abclzr 阅读(137) 评论(0) 推荐(0) 编辑
摘要: "http://www.lydsy.com/JudgeOnline/problem.php?id=4581" 考虑$O(n^3)$暴力。 实际上枚举最靠边的三个点就可以了,最多有12个点。 还是暴力= = 阅读全文
posted @ 2016-11-16 14:51 abclzr 阅读(150) 评论(0) 推荐(0) 编辑
摘要: "http://www.lydsy.com/JudgeOnline/problem.php?id=4579" 把时间倒过来,只是加点,并查集维护连通块。 c++ include include include using namespace std; const int N = 200003; st 阅读全文
posted @ 2016-11-16 14:51 abclzr 阅读(105) 评论(0) 推荐(0) 编辑
摘要: "http://www.lydsy.com/JudgeOnline/problem.php?id=3445" 加倍的边一定在最短路上(否则继续走最短路)。 最短路长度是O(n)的,暴力扫最短路上的每条边,再暴力dijkstra,时间复杂度$O(n^3)$。 话说堆优dij的复杂度到底多少?$O((n 阅读全文
posted @ 2016-11-16 14:51 abclzr 阅读(340) 评论(0) 推荐(0) 编辑
摘要: "http://www.lydsy.com/JudgeOnline/problem.php?id=4580" 区间dp,f(i,j)表示区间[i,j]全部合成一个数,这个数是多少。 可以归纳证明[i,j]如果可以合成一个数,那么只能合成这一个数 c++ include include include 阅读全文
posted @ 2016-11-16 14:50 abclzr 阅读(157) 评论(0) 推荐(0) 编辑