problem1 link
这个可以贪心地从前向后构造。假设当前已经的字符串为$S$,对于一个字符$c$来说,设将$c$加到$S$后得到的新串为$S^{‘}$。那么如果$X+Y+Z \ge minInv$,那么这个之后的构造就是有解的。其中$X$表示$S^{‘}$中逆序对个数;$Y$表示剩下的字符与$S^{‘}$中的字符构成的逆序对的个数;$Z$表示剩下的字符能构成的最大逆序对个数(从大到小排列即可)。
problem2 link
problem3 link
标签:.com class ini lan top srm href 字符串 topcoder
problem1 link
这个可以贪心地从前向后构造。假设当前已经的字符串为$S$,对于一个字符$c$来说,设将$c$加到$S$后得到的新串为$S^{‘}$。那么如果$X+Y+Z \ge minInv$,那么这个之后的构造就是有解的。其中$X$表示$S^{‘}$中逆序对个数;$Y$表示剩下的字符与$S^{‘}$中的字符构成的逆序对的个数;$Z$表示剩下的字符能构成的最大逆序对个数(从大到小排列即可)。
problem2 link
problem3 link
标签:.com class ini lan top srm href 字符串 topcoder
原文地址:https://www.cnblogs.com/jianglangcaijin/p/8687400.html