划分树
文章平均质量分 79
霜刃未曾试
这个作者很懒,什么都没留下…
展开
-
POJ 2104 K-th Number 划分树
题目:http://poj.org/problem?id=2104题意:给定一个数组,求给定区间内的第k大值思路:划分树模板题#include #include #include #include using namespace std;const int N = 100100;int n, m;int arr[N], arrs[N];int cut[原创 2016-05-17 13:22:33 · 419 阅读 · 0 评论 -
HDU 2665 Kth number 划分树
题目:http://acm.hdu.edu.cn/showproblem.php?pid=2665题意:求给定区间中的第k大值思路:划分树模板题#include #include #include #include using namespace std;const int N = 100010;struct node{ int l, r;}s原创 2016-05-17 14:21:03 · 550 阅读 · 0 评论 -
POJ 2761 Feed the dogs 划分树
题目:http://poj.org/problem?id=2761题意:跟POJ 2104 K-th Number一样,只是叙述不一样而已。。。#include #include #include #include using namespace std; const int N = 100100; int n, m; int arr[原创 2016-05-17 14:28:57 · 510 阅读 · 0 评论 -
HDU 4251 The Famous ICPC Team Again 划分树
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4251题意:给定一个数组,求区间中位数,保证给定区间长度是奇数思路:划分树求区间中位数#include #include #include #include using namespace std;const int N = 100010;struct node{原创 2016-05-17 16:09:12 · 489 阅读 · 0 评论 -
HDU 4417 Super Mario 划分树 + 二分
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4417题意:给定一个数组,下标从0开始,然后有一定数量的询问,问给定区间内小于等于给定值得个数思路:二分枚举第k小值,小于等于给定值时就更新结果为k,二分完毕后输出结果即可PS:话说当时正在宿舍看这道题,突闻系主任要点名,撒腿就跑,终于及时赶到。。。听所谓企业宣讲时想这道原创 2016-05-17 19:43:45 · 482 阅读 · 0 评论 -
HDU 3473 Minimum Sum 划分树
题目:http://acm.hdu.edu.cn/showproblem.php?pid=3473题意:给定一个数组,给定一些区间,找到一个数,使区间内的每个数减去这个数的绝对值的和最小思路:找到的这个数肯定是区间的中位数,用划分树易求,但是差值的绝对值求和就比较坑了,直接T了。。。设mid是中位数,那么最后的结果是xmid - x1 + xmid - x2 + ...+原创 2016-05-17 23:19:44 · 379 阅读 · 0 评论