摘要: 将每个人拆成两个节点,一端连房间,一端连食物,然后跑最大流。 (同某道牛-食物-饮料) (没写cur优化。。。) 1 #include <iostream> 2 #include <algorithm> 3 #include <cstdio> 4 #include <cstring> 5 #incl 阅读全文
posted @ 2017-01-28 22:10 KingSann 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 分数规划。 用dfs判断一下是否有负圈。 然后二分。 其实这道题在lrj的白书上面有,“再谈BF算法”中讲过将求图上环平均值转换到二分的方法。 1 #include <iostream> 2 #include <algorithm> 3 #include <cstdio> 4 #include <c 阅读全文
posted @ 2017-01-28 16:32 KingSann 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 贪心。 先以t2为关键字排一下序,然后开一个堆记录一下当前的t1,乱搞。。 1 #include <iostream> 2 #include <algorithm> 3 #include <cstdio> 4 #include <cstring> 5 #include <cstdlib> 6 #in 阅读全文
posted @ 2017-01-28 13:36 KingSann 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 神犇曰:“这道题不就是manacher裸题么,随便切一切吧” 我:“manacher是个啥。。。我只会hash啊。。” 看完manacher教程后:嗯?这都是个卵啊。。我去写hash吧。。 于是hash的pow数组写挂了。。。一直在WA。。。 终于A掉了。。 正着hash一遍然后反着hash一遍,最 阅读全文
posted @ 2017-01-27 14:08 KingSann 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 求树的重心 1 #include <iostream> 2 #include <algorithm> 3 #include <cstdio> 4 #include <cstring> 5 #include <cstdlib> 6 #include <queue> 7 #include <string 阅读全文
posted @ 2017-01-25 17:56 KingSann 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 同[poj1741]Tree。。。 (不过说好的数据范围呢。。。) 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <cstdlib> 5 #include <algorithm> 6 using n 阅读全文
posted @ 2017-01-25 16:20 KingSann 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 树分治。 边的话存的时候存成mod 3后的边就行,然后其他的就是套模板了。(数组开太大会被T的。。。) 1 #include <iostream> 2 #include <algorithm> 3 #include <cstdio> 4 #include <cstdlib> 5 #include < 阅读全文
posted @ 2017-01-25 15:17 KingSann 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 点分治入门。。 1 #include <iostream> 2 #include <algorithm> 3 #include <cstdio> 4 #include <cstdlib> 5 #include <cstring> 6 #include <cmath> 7 using namespac 阅读全文
posted @ 2017-01-25 10:56 KingSann 阅读(78) 评论(0) 推荐(0) 编辑
摘要: 标题:同伙描述:定义所有个字母序号之和相同的字符串为“同伙”。例如“ABC”和“CC”是一伙的,“ABC”和“AAA”不是一伙的。输入:第一行为S,第二行为字符串SS。输出:S中从左向右数第一个子串与SS是同伙,字符串的下标从零开始(的异世界生活(雾)),如果没有同伙,输出-1。范围:|S|,|SS 阅读全文
posted @ 2017-01-25 08:18 KingSann 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 某simpson自适应积分模板题。。。 总之看题解看会的Orz http://www.cnblogs.com/DaD3zZ-Beyonder/p/5676841.html 最后%%%QY 1 #include <iostream> 2 #include <algorithm> 3 #include 阅读全文
posted @ 2017-01-24 15:12 KingSann 阅读(150) 评论(0) 推荐(0) 编辑