tricky problems

· · 个人记录

Group 1 : 上界

CF2005D Alter the GCD

P5538 【XR-3】Namid[A]me

P8421 [THUPC 2022 决赛] rsraogps

CF1834E MEX of LCM

证一下答案上界:

设上界为 x,考虑固定一个端点时 \operatorname{lcm} 的个数,为 \log_2 x,总共可能取到的 \operatorname{lcm} 个数为 n \log_2 x,因此有 n \log_2 x < x。n=3 \times 10^5 时 x \le 6.81 \times 10^6。

CF2103F Maximize Nor

P13925 [POKATT 2024] 联合猫国 / The Paw-litical Game

不是人吧

P13785 [eJOI 2022] Longest Unfriendly Subsequence

P12012 [Ynoi April Fool's Round 2025] 牢爱

--- ## [CF1768F Wonderful Jump](https://www.luogu.com.cn/problem/CF1768F) --- ## [P17629 永远的朋友](https://www.luogu.com.cn/problem/P17629) $\log \log V$。 --- + $\log V+1$ 个数中必定存在一些数使得异或和为 $0$。 ## [CF2279E Save Me!](https://codeforces.com/contest/2279/problem/E) # Group 2 : 随机化 + 随机排列前缀最大值个数为 $O(\log n)$。 # Group 3 : 线性代数 + $\forall x,y \in S,x \operatorname{xor} y \in S \Leftrightarrow |S| = 2^{\dim S}

P8337 [Ynoi2004] rsxc & P8283 「MCOI-08」Dantalion

https://www.luogu.com.cn/article/43alta2g

Group 4 : 折半法

P10408 「SMOI-R1」Apple

类似:arc205e

CF2279E Save Me!

(其实上面有过了。)

考虑找答案上界。将底数从 2 优化至 \varphi。

Group 5 : MEX

\gdef\mex{\operatorname{MEX}}

我知道这很废话。

CF2049F MEX OR Mania

注意到 \mex(a) \le max(a)+1,\operatorname{OR}(a)\ge max(a)。\mex(a)-\operatorname{OR}(a) = 1 当且仅当 \{a_i\}=[0,2^k)。对每个 k 维护所有 <2^k 的极长段,对每个段维护每个数的出现次数,加数删数以及数不同数的个数是简单的。若当前修改后的这个数 \ge 2^k 则启发式分裂。O(n \log^3 n) 或 O(n \log^2 n)。

CF2146E Yet Another MEX Problem

对上面那个式子扫描线维护所有 p 的答案。

Group 6 : MST

P8207 [THUPC 2022 初赛] 最小公倍树

P7789 [COCI 2016/2017 #6] Sirni

CF1981E Turtle and Intersected Segments

一些边一定不会被选到;可能会选的边只有 O(n) 条。

AT_codefestival_2016_final_g Zigzag MST

CF888G Xor-MST

用菠萝贪心然后上 trie。

P9701 [GDCPC 2023] Classic Problem

贪心缩一些没用的点后菠萝。

P11134 【MX-X5-T6】「GFOI Round 1」Abiogenesis

菠萝扫描线线段树维护。

P11956

P3586

AT_abc424_g

P9339

CF2053I1

P10880

Group \inf : interactive

P6682