洛谷

https://www.luogu.org/problemnew/show/P2945

好像猜一猜就觉得排序之后是最优的,懒得证明了。每个城墙向他最接近的城墙靠近,绝对是最优的。

原文地址:https://www.cnblogs.com/Yinku/p/10355568.html