摘要:
pku2182:http://poj.org/problem?id=2182题意:给出n个数(1~n),接下来第2~n行输出n-1个数,第i个数num[i]表示原序列的第i个位置的数ans[i]前面的数中比他小的个数,求原序列。解法:线段树:先建树,用tot标记该线段中未确定的数的个数,用len表示线段长度,按所给的num从后往前推code:#include<iostream>#include<cstdio>#include<cstdlib>#include<algorithm>using namespace std;const int maxn 阅读全文