摘要:
http://acm.tju.edu.cn/toj/showp3758.htmlTJU 3758. Jewel 模拟题,开始数组为空,有以下操作:Insert x Put a bead with size x to the right of the chain (0 < x < 231, and x is different from all the sizes of beads currently in the chain)Query_1 s t k Query the k-th smallest bead between position s and t, inclusive. 阅读全文
posted @ 2011-03-05 20:26
AndreMouche
阅读(346)
评论(0)
推荐(0)
摘要:
http://acm.hdu.edu.cn/submit.php?pid=3473HDU 3473 Minimum Sum大意:已知n个正整数x0,x1,x2...xn-1排成一列,要求回答若干问题,问题类型如下:给你一个区间[l,r],要求sum(x-xi)(l<=i<=r)的最小值,其中x必须为xl,xl+1...xr中的一个数分析:易推得对于任意区间[l,r],符合条件的x为所在区间的中位数,求任意区间的中位数可以用划分树来解决,同样的,我们用suml[deep][i]来记录划分树中第deep层到数i位置放入左子树的数字的和,注意:当最后得出中位数median左边的和suml 阅读全文
posted @ 2011-03-05 18:50
AndreMouche
阅读(772)
评论(0)
推荐(0)

浙公网安备 33010602011771号