假设原来的高度范围是 $[0,d]$,那么经过高度 $a_i$ 的障碍后,高度的范围仍然形如 $[0,x]$,当 $a_i>d$ 时 $x=d$,当 $a_i\le d$ 时 $x=\max\{a_i-1,d-a_i\}$。注意这里 $x$ 关于 $d$ 是单调的,且因为初始 $d$ 都相同,所以在对右端点扫描线的过程当中,当前的 $d$ 关于左端点一定是单调的,可以直接用线段树维护。时间复杂度 $O((n+q)\log n)$。
QOJ.ac
QOJ
As we are currently experiencing an overwhelming number of web requests for fetching user submissions, we have temporarily disabled the full submissions list. You must now be logged in to view submissions.
Discussion #374 for Problem #14436. Robot Construction
Type: Editorial
Status: Open
Posted by: jiangly
Posted at: 2025-12-14 07:28:02
Last updated: 2025-12-14 07:28:06
题解
Comments
No comments yet.