有两个老哥 N≤105N\le 10^5N≤105 然后差分约束。
https://www.luogu.com.cn/article/upglsfli
https://www.luogu.com.cn/article/ftvyldn5
被卡了,Hack。
他们的代码:
https://www.luogu.com.cn/record/221588893
https://www.luogu.com.cn/record/221588847