QOJ.ac

QOJ

Type: Editorial

Status: Open

Posted by: Lynn_Sue

Posted at: 2026-07-17 09:47:48

Last updated: 2026-07-17 09:50:02

Back to Problem

题解

题解

二分答案 $w$。

小于 $w$ 一半的选了一定不劣。

大于 $w$ 一半的在两个小于 $w$ 一半的之间最多插一个,暴力枚举即可。

时间复杂度 $O(n \log V)$。$V$ 是值域。

后记

树姐姐可爱贴贴。

Comments

No comments yet.