题意
Sol
考场上做完前四题的时候大概还剩半个小时吧,那时候已经困的不行了。
看了看E发现好像很可做??
又仔细看了几眼发现这不是sb题么。。。
先考虑两个人,假设贡献分别为\((x, y) (a, b)\)
有两种组合方式,一种是\(x + b\),另一种是\(y + a\)
若\(x + b >= y + a\)
那么\(x - y >= a - b\)
因此我们按照\(x - y\)排序,对于每个位置,肯定是某一个前缀全选\(x+b\),除此之外都是\(y+a\)
二分之后前缀和后缀和安排一下
#include #include #include #include #include