摘要:
带权并查集中,dist[]数组可以理解为一个向量,这样子比按照距离来理解更透彻: 优秀学习资料: AcWing 240. 食物链(带权并查集) - AcWing 即d[a]表示向量a->fa[a] 这道题的并查集解法: #include <iostream> #include <stdio.h> # 阅读全文
posted @ 2024-03-25 20:36
Gold_stein
阅读(44)
评论(0)
推荐(0)
摘要:
#include <bits/stdc++.h> #define int long long using namespace std; const int N = 3e6 + 9; int a[N]; char b[N]; signed main() { ios::sync_with_stdio(0 阅读全文
posted @ 2024-03-25 14:22
Gold_stein
阅读(53)
评论(0)
推荐(0)

浙公网安备 33010602011771号