Contest 1428

A

移动次数是 (left|x_1-x_2 ight|+left|y_1-y_2 ight|)

如果 (x_1 ot=x_2)(y_1 ot=y_2) 说明要换方向,两次额外移动。

时间复杂度 (Oleft(t ight))

B

如果 ( exttt>)( exttt<) 只存在至多一种,答案为 (n)

否则向一边出去后就必须原路返回,两边至少有一个 ( exttt-)

时间复杂度 (Oleft(tn ight))

C

从后向前做,记录 ( exttt B) 的个数,能删 ( exttt{AB}) 就删,最后 ( exttt{BB}) 再一起删。

时间复杂度 (Oleft(sumleft|s ight| ight))

剩下的鸽掉了。

原文地址:https://www.cnblogs.com/May-2nd/p/13927440.html