每次贪心选最长的一段前缀满足至少有一个数没有出现即可,因为这个段的长度至少是 $X-1$,因此可以直接用数组记录出现过的数。时间复杂度 $O(N)$。
QOJ.ac
QOJ
The 3rd Universal Cup Finals is coming! Join our Warm-up Game and Prediction Game and win the prizes! Learn more...
Discussion #1486 for Problem #17422. Except Ai
Type: Editorial
Status: Open
Posted by: jiangly
Posted at: 2026-04-09 18:04:30
Last updated: 2026-04-09 18:05:33
题解
Comments
No comments yet.