QOJ.ac

QOJ

Type: Editorial

Status: Open

Posted by: Milmon

Posted at: 2026-03-29 19:50:41

Last updated: 2026-03-29 19:50:46

Back to Problem

题解

从前往后每次贪心选取一个尽可能长的不同时包含 $1 \sim X$ 所有数的段令它们全相等即可。

时间复杂度为 $\mathcal{O}(N)$。

Comments

No comments yet.