上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 14 下一页
摘要: http://blog.csdn.net/cjk_cjk/article/details/43380249 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 void setIO... 阅读全文
posted @ 2016-01-06 21:41 Showson 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 不就是移一下树根,回溯一下吗? 诶?黄学长为什么可以直接找? 诶?这不是重心吗? YY了一下证明 很简单 由于重心max{sz[v]} <= sz[u] / 2的性质,可以证明每一步远离重心的移动都不会使答案更优,每一步靠近重心的移动都不会使答案更劣,且只与子树大小有关,与边权无关(显然要非负才行) 阅读全文
posted @ 2016-01-06 20:00 Showson 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 留坑(p.339) 已填(膜汪)每条直线至少经过两个点,我们不妨在经过的所有点中的第二个点统计它设f[i][j]表示i * j的答案,那么显然可以用f[i][j] = f[i - 1][j] + f[i][j - 1] - f[i - 1][j - 1] + 以(i, j)这个点为第二个经过的点的直... 阅读全文
posted @ 2016-01-06 16:17 Showson 阅读(189) 评论(1) 推荐(0) 编辑
摘要: 破环qwq 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 void setIO(const string& s) { 10 freopen((s +... 阅读全文
posted @ 2016-01-06 11:04 Showson 阅读(149) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/Tunix/p/4354348.html 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 void setIO(... 阅读全文
posted @ 2016-01-05 21:38 Showson 阅读(394) 评论(0) 推荐(0) 编辑
摘要: 咦,这里有好多东西https://en.wikipedia.org/wiki/Catalan_number每个矩形最多贡献一个拐角枚举左上角的点和那个拐角是一个矩形 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 ... 阅读全文
posted @ 2016-01-05 20:46 Showson 阅读(392) 评论(0) 推荐(0) 编辑
摘要: 卡特兰数 http://www.cnblogs.com/zhber/p/4181190.html 2016.3.4 updated: 无意中翻出来了,发现之前的写的跑的很慢,就去看了下 发现分解质因数可以是logn的而我写的n0.5的。 #include<cstdio> #include<cstri 阅读全文
posted @ 2016-01-05 20:20 Showson 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 填坑系列(p.302)既然不知道后面还要卖多少个就加一维状态嘛。。lrj写的O(n)转移?其实转移可以O(1)貌似按x排序有奇效? 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 ... 阅读全文
posted @ 2016-01-05 11:36 Showson 阅读(320) 评论(0) 推荐(0) 编辑
摘要: 留坑(p.256)什么找规律啊 坑爹 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 void setIO(const string& s) {10 freopen((... 阅读全文
posted @ 2016-01-04 09:56 Showson 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 挺好的一道题呢O(n^2)或者O(wh) 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 void setIO(const string& s) {10 freopen... 阅读全文
posted @ 2016-01-04 09:25 Showson 阅读(122) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 14 下一页