随笔分类 - AtCoder
摘要:洛谷传送门 AtCoder 传送门 看到和度数有关的(基环)树计数,可以想到 Prufer 序。 如果要计数一棵树,那么答案就是 \(\binom{n - 2}{d_1 - 1, d_2 - 1, \ldots, d_n - 1}\)。因为度数为 \(d\) 的点在 Prufer 序中恰好出现 \(
阅读全文
摘要:洛谷传送门 AtCoder 传送门 若 \(2\min\limits_{i = 1}^m a_i < \max\limits_{i = 1}^n a_i\) 就无解,因为根据排列的性质必然存在 \(yxxxy\) 或两端 \(xxyy\) 的情况,并且若这个条件不满足,就可以构造一组解。 考虑最小化
阅读全文
摘要:洛谷传送门 AtCoder 传送门 考虑若重排好了 \(a\),如何判断可不可行。显然只用把 \(b\) 排序,把 \(\min(a_{i - 1}, a_i)\) 也排序(定义 \(a_0 = a_{n + 1} = +\infty\)),按顺序逐个判断是否大于即可。 这启示我们将 \(\min(
阅读全文
摘要:洛谷传送门 AtCoder 传送门 首先将 \(a\) 从小到大排序,设 \(p_i\) 为排序后的 \(a_i\) 位于原序列第 \(p_i\) 个位置,\(x_i\) 为要填的排列的第 \(i\) 个数。 设 \(A = \prod\limits_{i = 1}^n (a_i - i + 1)\
阅读全文
摘要:洛谷传送门 AtCoder 传送门 悲,赛时代码赛后被 hack 了。 发现对子段排序不会使排列的字典序变大。因此若存在长度 \(\ge k\) 的递增子段直接输出原排列。 否则答案与原排列的 \(\text{LCP}\) 至少为 \(n - k\)(可以通过对 \([n - k + 1, n]\)
阅读全文
摘要:啥都不会。自闭了。 A 显然填充 \(1\) 不会影响 \(\text{lcm}\)。 枚举 \(n\) 的互质且 \(\text{lcm} = n\) 的因数,看和是否 \(\le n\) 即可。 B 悲,赛时代码赛后被 hack 了。 发现对子段排序不会使排列的字典序变大。因此若存在长度 \(\
阅读全文
摘要:洛谷传送门 AtCoder 传送门 人生中第一道 AtCoder 问号题。 设 \(P = 998244353\)。 注意到 \(f(T)\) 的定义式中,\(\frac{1}{n}\) 大概是启示我们转成概率去做。发现若把 \(\frac{1}{n}\) 换成 \(\frac{1}{n - 1}\
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc041_f "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc041/tasks/agc041_f "AtCoder 传送门") 神题!!!!!!!
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc317_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc317/tasks/abc317_g "AtCoder 传送门") 考虑转化成匹配问题
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_cf17_final_j "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/cf17-final/tasks/cf17_final_j "AtCoder 传送门
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc040_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc040/tasks/agc040_e "AtCoder 传送门") 比较神奇的题。 考
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc311_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc311/tasks/abc311_g "AtCoder 传送门") 考虑一维怎么做。
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc049_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc049/tasks/agc049_e "AtCoder 传送门") 好题。同时考查了
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc032_d "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc032/tasks/agc032_d "AtCoder 传送门") 设 $b_i$ 为
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc092_c "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc092/tasks/arc092_c "AtCoder 传送门") Key obser
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc309_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc309/tasks/abc309_h "AtCoder 传送门") 挺妙的题。 考虑
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc012_d "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc012/tasks/agc012_d "AtCoder 传送门") 不错的题。bx E
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc164_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc164/tasks/arc164_e "AtCoder 传送门") 妙妙题。 我们考虑
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc309_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc309/tasks/abc309_g "AtCoder 传送门") 前置知识:[[AR
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc308_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc308/tasks/abc308_h "AtCoder 传送门") 这是官方题解的 $
阅读全文

浙公网安备 33010602011771号