AC日记——Super Mario hdu 4417】的更多相关文章

Super Mario Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6122    Accepted Submission(s): 2660 Problem Description Mario is world-famous plumber. His “burly” figure and amazing jumping ability…
Super Mario HDU 4417 主席树区间查询 题意 给你n个数(编号从0开始),然后查询区间内小于k的数的个数. 解题思路 这个可以使用主席树来处理,因为这个很类似查询区间内的第k小的问题.当然我们需要进行离散化,不只是那n个数,k也需要进行离散化. 详情看代码吧,有注释. 代码实现 #include<cstdio> #include<cstring> #include<algorithm> #include<vector> using name…
J - Super Mario HDU - 4417 这个题目我开始直接暴力,然后就超时了,不知道该怎么做,直接看了题解,这个习惯其实不太好. 不过网上的思路真的很厉害,看完之后有点伤心,感觉自己应该可以写的,但是没有写出来. 因为我们要查找一个区间小于等于c的数有多少个,这种区间处理可以用线段树很好的解决, 但是怎么解决呢,我习惯性的直接建树,然后再想怎么做,其实这样不对, 线段树对于我们来说是一个解决问题的工具,不要本末倒置了. 我们想查找一个区间小于等于c的数的个数,用线段树查询很简单,但…
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 (the length is n), on…
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 (the length is n), on…
2222 思路: ac自动机模板题: 代码: #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; #define maxn 500005 struct TreeNodeType { int count; TreeNodeType *fail; TreeNodeType *next[]; TreeNodeType()…
Number Sequence Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 24928    Accepted Submission(s): 10551 Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1],…
统计难题 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131070/65535 K (Java/Others)Total Submission(s): 36637    Accepted Submission(s): 13622 Problem Description Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的…
2896 思路: 好题: 代码: #include <queue> #include <cstdio> #include <cstring> using namespace std; #define maxn 100001 ][],tag[],fail[],n,tot,m,ans; char ch[maxn]; ],]; queue<int>que; int main() { int i,j,len,now,temp; scanf("%d"…
Paint Pearls 思路: 离散化+dp+剪枝: dp是个n方的做法: 重要就在剪枝: 如果一个长度为n的区间,有大于根号n种颜色,还不如一个一个涂: 来,上代码: #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; #define maxn 50005 int n,ai[maxn],dp[maxn],ls[…