D. Restore Permutation 题意:给定n个数a[i],a[ i ]表示在[b[1],b[i-1]]这些数中比 b[i]小的数的和,要你构造这样的b[i]序列 题解:利用树状数组 求比b[i]小的数的和,在从大到小二分枚举最大的一个数x,使得左边小于x的所有数的和小于等于a[i],vis保存记录x即可 #include<iostream> #include<string.h> #define ll long long using namespace std; ll…
E. Anton and Permutation time limit per test 4 seconds memory limit per test 512 megabytes input standard input output standard output Anton likes permutations, especially he likes to permute their elements. Note that a permutation of n elements is a…