随笔分类 - 并查集
acm
摘要:#### 链接 https://www.luogu.com.cn/problem/P8686 #### 题意 给你 $n$ 个数 a[1...n],从 $a_2$ 开始,如果和之前的某个数具有相等的值,就一直让 $a_i = a_i + 1$,直到前面的任何一个数都和它不相等 $1 \leq n \
阅读全文
摘要://并查集模板 亲戚 #include<cstdio>using namespace std;int father[5005]; int f(int x){ //寻找每个结点的父亲结点 int r=x; while(father[r]!=r){ r=father[r]; } return r;} i
阅读全文

浙公网安备 33010602011771号