摘要: 自己YY一下可以发现answer = n - fail[ n ]-----------------------------------------------------------------------------------#include#include#include#include#de... 阅读全文
posted @ 2015-06-07 17:48 JSZX11556 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 计算距离时平方爆了int结果就WA了一次......-----------------------------------------------------------------------------------------#include#include#include#include#in... 阅读全文
posted @ 2015-06-07 16:51 JSZX11556 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 从起点和终点各跑一次最短路 , 然后枚举每一条边 , 更新answer-----------------------------------------------------------------------------------------------------#include#inclu... 阅读全文
posted @ 2015-06-07 16:11 JSZX11556 阅读(366) 评论(0) 推荐(0) 编辑
摘要: orz...hzwer 对着大神的 code 看 , 稍微理解了.考虑一只牛到达 , 那它所在子树全部 +1 , 可以用BIT维护-----------------------------------------------------------------------#include#inclu... 阅读全文
posted @ 2015-06-07 15:36 JSZX11556 阅读(281) 评论(0) 推荐(0) 编辑
摘要: BFS...--------------------------------------------------------------------------------------------#include#include#include#include#include#define rep(... 阅读全文
posted @ 2015-06-07 12:41 JSZX11556 阅读(547) 评论(0) 推荐(0) 编辑
摘要: 先按时间排序( 开始结束都可以 ) , 然后 dp( i ) = max( dp( i ) , dp( j ) + 1 ) ( j #include#include#include#define rep( i , n ) for( int i = 0 ; i > n; rep( i , n ) ... 阅读全文
posted @ 2015-06-07 12:23 JSZX11556 阅读(316) 评论(0) 推荐(0) 编辑
摘要: dp( L , R ) = max( dp( L + 1 , R ) + V_L * ( n - R + L ) , dp( L , R - 1 ) + V_R * ( n - R + L ) )边界 : dp( i , i ) = V[ i ] * n-----------------------... 阅读全文
posted @ 2015-06-07 11:36 JSZX11556 阅读(326) 评论(0) 推荐(0) 编辑
摘要: 裸最短路..------------------------------------------------------------------------------------#include#include#include#include#include#define rep( i , n )... 阅读全文
posted @ 2015-06-07 11:23 JSZX11556 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 选取任意一个点为root , size[ x ] 表示以 x 为根的子树的奶牛数 , dp一次计算出size[ ] && 选 root 为集会地点的不方便程度 . 考虑集会地点由 x 点向它的子节点 son 转移 , 那么以 son 为集会地点比以 x 为集会地点要多 dist( x , son )... 阅读全文
posted @ 2015-06-07 10:49 JSZX11556 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 线段树..--------------------------------------------------------------------------------------#include#include#include#include#define rep( i , n ) for( i... 阅读全文
posted @ 2015-06-07 09:54 JSZX11556 阅读(169) 评论(0) 推荐(0) 编辑