hdu4417 Super Mario】的更多相关文章

http://acm.hdu.edu.cn/showproblem.php?pid=4417 Super Mario Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2720    Accepted Submission(s): 1322 Problem Description Mario is world-famous plumber…
题目链接: Super Mario Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 32768/32768 K (Java/Others) Problem Description Mario is world-famous plumber. His “burly” figure and amazing jumping ability reminded in our memory. Now the poor princess is…
Super Mario 这个题也做了一天,思路是很清晰,不过二分那里写残了,然后又是无限RE.. 题意:就是查询区间不大于k的数的个数. 思路:裸划分树+二分答案.将区间长度作为二分范围.这个是重点.没AC之前无限YY,AC之后却又觉得不过如此. int a[N],tree[30][N],t_l[30][N]; void build(int l,int r,int id) { if(l==r) return ; int mid=(l+r)/2,same=mid-l+1; for(int i=l;…
Problem Description Mario is world-famous plumber. His “burly” figure and amazing jumping ability reminded in our memory. Now the poor princess is in trouble again and Mario needs to save his lover. We regard the road to the boss’s castle as a line (…
题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=4417 Description Mario is world-famous plumber. His “burly” figure and amazing jumping ability reminded in our memory. Now the poor princess is in trouble again and Mario needs to save his lover. We…
Problem Description Mario is world-famous plumber. His “burly” figure and amazing jumping ability reminded in our memory. Now the poor princess is in trouble again and Mario needs to save his lover. We regard the road to the boss’s castle as a line (…
题目大意 给定一个数列,每次要求你查询区间[L,R]内不超过K的数的数量 题解 和静态的区间第K大差不多,这题是<=K,先建立好n颗主席树,然后用第R颗主席树区间[1,K]内数的数量减去第L-1颗主席树区间[1,K]内数的数量就得到了查询的结果 代码: #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; #d…
题目链接 题目让求 L R区间 不大于H 的数有多少 数据太大需要离散化 #include<bits/stdc++.h> using namespace std; #define maxn 100010 int a[maxn],root[maxn],tot,n,m; vector<int>q; struct ac{ int va,l,r; }tre[maxn*]; void init(){ memset(root,,sizeof(root)); memset(tre,,sizeof…
传送门 又是一道主席树模板题,注意数组从0开始,还有主席树耗费空间很大,数组开大点,之前开小了莫名其妙TLE.QAQ ——代码 #include <cstdio> #include <cstring> #include <algorithm> #define ls son[now][0], l, mid #define rs son[now][1], mid + 1, r using namespace std; ; int T, n, m, sz, tot, ans;…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4417 题目大意:给定一个长度为n的序列,有m个询问,每次询问包含l,r,h,即询问区间[l,r]小于等于h的数目. 解题思路:很多种解法,写了三种 1.树状数组离线处理 将序列和所有操作的h从小到大排序,都设为结构体类型以便保存下标,然后按顺序从小到大将序列的下标更新到树状数组中,如果下一个询问的h要大于当前询问的h时,则处理该询问,因为我们已经将小于等于h的数全部更新到树状数组中,所以直接区间求和…