并查集
lonely_wind_
路漫漫兮
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
2020牛客暑期多校第八场I-Interesting Computer Game(离散化+并查集)
博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13435543.html题目大意:给你T组数据,每组数据给你n对数,分别表示为ai,bi(1≤ai,bi≤109)a_i,b_i(1\leq a_i,b_i\leq 10^9)ai,bi(1≤ai,bi≤109),你每次都可以取其中的一个,但如果之前aia_iai已经被取过了,就不能再取了,bib_ibi也是一样的。那么问你总共可以取多少种不同的数。(T≤10,n≤1e5)(T\leq 10,n\l原创 2020-08-04 20:02:49 · 358 阅读 · 0 评论 -
CodeForces 734E-Anton and Tree(并查集缩点+树的直径)
题目链接:https://codeforces.com/problemset/problem/734/E博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13417220.htmlAnton is growing a tree in his garden. In case you forgot, the tree is a connected acyclic undirected graph.There are n vertices in the tree,原创 2020-08-01 23:30:06 · 528 阅读 · 0 评论 -
2020杭电HDU-6763多校第二场Total Eclipse(并查集)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6763博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13383968.htmlProblem DescriptionThere are n cities and m bidirectional roads in Byteland. These cities are labeled by 1,2,…,n, the brightness of the i-th c原创 2020-07-27 10:16:57 · 545 阅读 · 0 评论 -
HDU-1272小希的迷宫(并查集的运用)
小希的迷宫Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1272Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计...原创 2019-03-14 18:54:53 · 323 阅读 · 0 评论 -
H.“提莫队长正在待命!”(并查集的运用)
“提莫队长正在待命!”Description迅捷斥候·提莫作为班德尔城安全的侦察兵首领,也是班德尔城最富盛名的特种部队之一“主舰斥候队”一员,平时他会在各处巡逻保证班德尔城的安危。我们现在可以把班德尔城看做由n个小城镇组成的大城市,在这n个城市之间有n-1条道路将这n个小城镇连接起来(也就是说这n个小城镇形成了一个树形的结构)。由于城镇太多,提莫一个人无法把所有的城镇巡逻到,所以他会在某些...原创 2019-03-06 21:38:20 · 1675 阅读 · 0 评论 -
C. Edgy Trees---(思维题+并查集的运用)---Codeforces Round #548 (Div. 2)
Edgy Treestime limit per test 2 secondsmemory limit per test 256 megabytes题目链接http://codeforces.com/contest/1139/problem/C#include <cstdio>#define ll long longconst int mod=1e9+7;con...原创 2019-03-28 22:07:36 · 411 阅读 · 0 评论 -
银河英雄传说--AcWing238&洛谷P1196(带权并查集)
题目链接https://www.acwing.com/problem/content/description/240/有一个划分为N列的星际战场,各列依次编号为1,2,…,N。有N艘战舰,也依次编号为1,2,…,N,其中第i号战舰处于第i列。有T条指令,每条指令格式为以下两种之一:1、M i j,表示让第i号战舰所在列的全部战舰保持原有顺序,接在第j号战舰所在列的尾部。2、C ...原创 2019-09-03 10:53:40 · 429 阅读 · 1 评论
分享