摘要: BFS+强连通。输出max(缩点后出度为0的点数,缩点后入度为0的点数)。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define LL unsigned __int64 7 using... 阅读全文
posted @ 2015-03-09 22:59 chenjunjie1994 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 连接点应该是只需连接而不必覆盖。按开始时间排序。假设当前最远为t,则按序枚举在t+1范围内开始的cow即可,再求出最远点。注意break条件。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define ... 阅读全文
posted @ 2015-03-09 21:40 chenjunjie1994 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 这道题以前好像在哪遇到过。注意树的每一条边都是桥,所以,桥两端的点要到达对方是必须通过这条边的。于是,可以把边由小到大排序,利用并查集,这样,每加一条边就连通了一部分,而随着权值的增大,必定是桥两端到达对方经过的最大的边。于是总的权为左边集合数*右边集合数*桥的权值,就可以求出最大值和了。求最小值和... 阅读全文
posted @ 2015-03-09 15:56 chenjunjie1994 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 题意有点不明白,因为MAX为int最大值,推测为64位,AC#include #include #include #include #include #define LL __int64using namespace std; const LL MAX=2147483647;cons... 阅读全文
posted @ 2015-03-09 11:13 chenjunjie1994 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 我想了很久了,后来还是把N分解质因数,枚举各种组合,反正也不多吧,按题目条件,然后就过了。#include #include #include #include #include #define LL __int64using namespace std; LL prime[1000... 阅读全文
posted @ 2015-03-09 11:12 chenjunjie1994 阅读(169) 评论(0) 推荐(0) 编辑