码迷,mamicode.com
首页 > 其他好文 > 详细

topcoder srm 545 div1

时间:2018-04-01 17:46:42      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:.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

topcoder srm 545 div1

标签:.com   class   ini   lan   top   srm   href   字符串   topcoder   

原文地址:https://www.cnblogs.com/jianglangcaijin/p/8687400.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!