https://codeforces.com/contest/1852/problems
A. Ntarsis' Set
https://codeforces.com/contest/1852/problem/A
感觉不是很一眼。
\(n\) 和 \(k\) 都是 \(2 \times 10^5\),不能暴力,设当前集合为 \({1, 2, \dots, 10^{1000}}\),那么被操作过一次的最小值就应该是 \(\text{MEX}(0, a_1, a_2, \dots, a_n)\)。
扩展一下,集合 \(S\) 被操作过一次的最小值就是 \(S_{\text{MEX}(0, a_1, a_2, \dots, a_n)}\)(其中 \(S_k\) 为 \(S\) 的第 \(k\) 小值)。
观察样例及其解释:
5 3
1 3 5 6 7
Day | \(S\) Before | \(S\) After |
---|---|---|
\(1\) | \(\{\cancel 1, 2, \cancel 3, 4, \cancel 5, \cancel 6, \cancel 7, 8, 9, 10, \ldots \}\) | \(\{2, 4, 8, 9, 10, \ldots\}\) |
\(2\) | \(\{\cancel 2, 4, \cancel 8, 9, \cancel{10}, \cancel{11}, \cancel{12}, 13, 14, 15, \ldots\}\) | \(\{4, 9, 13, 14, 15, \ldots\}\) |
\(3\) | \(\{\cancel 4, 9, \cancel{13}, 14, \cancel{15}, \cancel{16}, \cancel{17}, 18, 19, 20, \ldots\}\) | \(\{9, 14, 18, 19, 20, \ldots\}\) |
标签:dots,10,13,887,14,题解,cancel,Div,ldots From: https://www.cnblogs.com/RB16B/p/17577810.html