正文
增加 6 行删除 4 行
123456789101112131414 行未改动2930313233### [P12675 「LAOI-8」Boundary](https://www.luogu.com.cn/problem/P12675)不难发现,只有两种可能,要么直接对 $[1,n]$ 操作,要么对 $[1,x]$ 操作,然后对 $[y,n]$ 操作,最后对 $[1,n]$ 操作。所以你维护前缀跟 $A_1$ 绝对值最接近的数,后缀跟 $A_n$ 最接近的数,就好了。### [P13308 故障](https://www.luogu.com.cn/problem/P13308)利用 01-trie 离散化,然后每次往上跑,并给这个点的所有仍然连接着的祖先都减去这个点的 $siz$ 即可。### [[ABC416F] Paint Tree 2](https://www.luogu.com.cn/problem/AT_abc416_f)[题解](https://www.luogu.com.cn/article/g02vjwml)14 行未改动[题解](https://www.luogu.com.cn/article/3nbv5wkc)### [【MX-X18-T5】「FAOI-R6」纯蓝](https://www.luogu.com.cn/problem/P13833)没有题解。1234567891011121314151614 行未改动3132333435### [P13308 故障](https://www.luogu.com.cn/problem/P13308)利用 01-trie 离散化,然后每次往上跑,并给这个点的所有仍然连接着的祖先都减去这个点的 $siz$ 即可。### [P12675 「LAOI-8」Boundary](https://www.luogu.com.cn/problem/P12675)不难发现,只有两种可能,要么直接对 $[1,n]$ 操作,要么对 $[1,x]$ 操作,然后对 $[y,n]$ 操作,最后对 $[1,n]$ 操作。所以你维护前缀跟 $A_1$ 绝对值最接近的数,后缀跟 $A_n$ 最接近的数,就好了。注意有可能减少操作 2 的代价,而由于 $A$ 是排列,所以只需要考虑 $|A_i-A_j|=1$,特殊处理这种情况即可。### [[ABC416F] Paint Tree 2](https://www.luogu.com.cn/problem/AT_abc416_f)[题解](https://www.luogu.com.cn/article/g02vjwml)14 行未改动[题解](https://www.luogu.com.cn/article/3nbv5wkc)### [【MX-X18-T5】「FAOI-R6」纯蓝](https://www.luogu.com.cn/problem/P13833)[题解](https://www.luogu.com.cn/article/1rnkcsvl)