主席树 又称函数式线段树,又称可持久化线段树……缺点是内存有点儿大…… type node1=record l,r,sum:longint; end; node2=record x,idx:longint; end; var q,i,j,k,tot,n,m:longint; a:..] of node2; rank,root:..] of longint; t:..] of node1; procedure qsort(h,l:longint); var i,j,m:longint; temp: