随笔分类 -  dfs 树

摘要:洛谷传送门 AtCoder 传送门 喵喵题。 考虑若所有点权都已确定,如何求 \(1\) 到 \(n\) 所有路径权值和的 \(\gcd\)。 考虑如何 check 一个 \(x\) 是否合法。考虑拆点,把点权转成边权,在新图上连边 \(u \to u'\),边权 \(a_u\);\(u' \to 阅读全文
posted @ 2023-11-22 18:33 zltzlt 阅读(31) 评论(0) 推荐(0)
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/CF1364D "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1364/D "CF 传送门") 简单题。 特判掉 $m = n - 1$ 的情况 阅读全文
posted @ 2023-07-12 08:10 zltzlt 阅读(44) 评论(0) 推荐(0)
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc306_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc306/tasks/abc306_g "AtCoder 传送门") 考虑若干个能被 $ 阅读全文
posted @ 2023-06-18 10:42 zltzlt 阅读(188) 评论(8) 推荐(1)