loading...

摘要: 先放犯错后 be like: 1 return // 倍增求 lca int bfs(int x) { queue<int> q; q.push(x); dep[x] = 1; while (q.size()) { x = q.front(), q.pop(); for (auto it : G[x 阅读全文
posted @ 2025-02-11 20:36 goldspade 阅读(19) 评论(0) 推荐(0)
摘要: 链接 Description 给定有 \(n(n \le 10^5)\) 个点的树,每次操作等概率随机选取一个存在的节点删除他和他的子树,问期望的操作次数。 Solution 考虑转化题意。假设 \(c_i\) 表示某个节点被选到的次数(显然取值只有 \(0/1\)),题目相当于求 \(\sum c 阅读全文
posted @ 2025-02-11 18:42 goldspade 阅读(40) 评论(0) 推荐(0)
摘要: statement 给定长为 \(n\) 的数列 \(A_i,B_i\),求所有 \(n\) 排列 \(P_i\) 的权值最小值。\((2\le n \le10^6)\) 排列权值 \(=\max\left\{\max \limits_{1 \le i \le n} \{A_{P_i}^2-B_{P 阅读全文
posted @ 2025-02-11 18:37 goldspade 阅读(16) 评论(0) 推荐(0)