随笔分类 - 贪心
摘要:题目传送门 For a sequence $t_{1...n}$we define the weight of it is the number of pairs $(i,j)$satisfy \(i<j\) and \(t_i>t_j\) Now give you a permutation a_
阅读全文
摘要:####分析: 假如是 \(A:1\ 5\) \(B:2\ 6\) 可知通过一次替换变成 \(A:1\ 2\) \(B:5\ 6\) $发现原来的$ans$是$(2-1)+(6-5)$,那么现在的$ans$变成$(5-1)+(6-2)$,和原$ans$相比,新的$ans$更大,因为把-5变+5,把+
阅读全文

浙公网安备 33010602011771号