Wilbur and Array Time Limit: 2000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Submit Status Description Wilbur the pig is tinkering with arrays again. He has the array a1, a2, ..., an initially consisting of n zeros. At one step, he c…
Arthur and Table CodeForces - 557C 首先,按长度排序. 长度为p的桌腿有a[p]个. 要使得长度为p的桌腿为最长,那么要按照代价从小到大砍掉sum{长度不到p的腿的数量}-a[p]+1条腿.还需要将所有长于p的桌腿砍光.枚举p即可. 要点(看了题解才明白):可以通过精力最高只有200的条件,大大缩小时间/空间复杂度. 恩,所以...这是贪心吧? #include<cstdio> #include<algorithm> using namespace…