Description 依次删去一个点和它的边,问当前图是否连通. Sol 并查集. 倒着做就可以了. 每次将一个点及其的边加入,如果当前集合个数大于 1,那么就不连通. Code ...
分类:
其他好文 时间:
2016-11-16 22:32:29
阅读次数:
457
Description To improve the organization of his farm, Farmer John labels each of his N (1 <= N <= 5,000) cows with a distinct serial number in the rang ...
分类:
其他好文 时间:
2016-11-15 23:49:25
阅读次数:
507
题目链接 DFS的简单应用,比较繁琐的是处理输入的英文字母。用并查集也可以做(可是笔者现在还没有掌握并查集,之前只用过一次,以后学会回来补上) ...
分类:
其他好文 时间:
2016-11-04 13:41:59
阅读次数:
212
System design First no limitation Then enroll the real world: Horizontal scaling Vertical Scaling Load balancer: server farm: increase security Big da ...
分类:
其他好文 时间:
2016-11-01 09:33:37
阅读次数:
139
题目描述 每年万圣节,威斯康星的奶牛们都要打扮一番,出门在农场的N个牛棚里转 悠,来采集糖果.她们每走到一个未曾经过的牛棚,就会采集这个棚里的1颗糖果. 农场不大,所以约翰要想尽法子让奶牛们得到快乐.他给每一个牛棚设置了一个“后继牛 棚”.牛棚i的后继牛棚是next_i 他告诉奶牛们,她们到了一个牛 ...
分类:
其他好文 时间:
2016-11-01 07:40:19
阅读次数:
166
Farmer John has a number of pastures on his farm. Cow paths connect some pastures with certain other pastures, forming a field. But, at the present ti ...
分类:
其他好文 时间:
2016-10-04 16:30:11
阅读次数:
223
题目描述 Farmer John and his cows are planning to leave town for a long vacation, and so FJ wants to temporarily close down his farm to save money in the ...
分类:
其他好文 时间:
2016-10-03 06:54:50
阅读次数:
165
Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 11334 Accepted: 5222 Description The cows have reconstructed Farmer John's farm, with its N ...
分类:
其他好文 时间:
2016-09-29 01:38:35
阅读次数:
157
bzoj1589[Usaco2008 Dec]Trick or Treat on the Farm 采集糖果 题意: n个节点,每个节点有一个后继节点,问从每个节点出发能到多少个没去过的节点。n≤100000。 题解: 因为每个节点只有一个后继节点,所有tarjan缩点后就会变成一堆链,对每条链df ...
分类:
其他好文 时间:
2016-09-25 17:22:45
阅读次数:
155
题目描述 Farmer John and his cows are planning to leave town for a long vacation, and so FJ wants to temporarily close down his farm to save money in the ...
分类:
其他好文 时间:
2016-09-18 22:14:52
阅读次数:
181