![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树状数组
等我学会后缀自动机
侠影之谜
展开
-
CodeForces 1254D Tree Queries (树链剖分技巧+树状数组)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-02-19 12:11:01 · 288 阅读 · 0 评论 -
HDU 6534 Chika and Friendly Pairs (莫队+树状数组+离散化+预处理)
#include<bits/stdc++.h>using namespace std;#define rep(x,y,z) for(int (x)=(y);(x)<(z);x++)#define mst(x,y) memset(x,y,sizeof(x))#define ll long long#define pii pair<int,int> #def...原创 2020-02-04 10:06:42 · 110 阅读 · 0 评论 -
CodeForces - 629D Babaei and Birthday Cake (线段树+DP裸题目)
题目链接:http://codeforces.com/problemset/problem/629/D#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x...原创 2018-09-28 20:34:26 · 189 阅读 · 0 评论 -
HDU 4777 Rabbit Kingdom (树状数组+离线+思维)*
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4777#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x...原创 2018-10-06 15:21:04 · 129 阅读 · 0 评论 -
HDU 6406 Taotao Picks Apples (单调栈+树状数组统计+离散化)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6406#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x...原创 2018-10-12 19:12:30 · 98 阅读 · 0 评论 -
POJ - 2481 Cows(树状数组+水)纪念第三百题
题目链接:http://poj.org/problem?id=2481///#include<bits/stdc++.h>#include<cstdio>#include<cstring>#include<algorithm>#include<map>using namespace std;#define debug ...原创 2018-09-27 11:36:45 · 114 阅读 · 0 评论 -
UVA 1406 A Sequence of Numbers (树状数组+位权思维)*
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4152#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#...原创 2018-10-11 22:50:13 · 323 阅读 · 0 评论 -
CodeForces 799C Foundatins (树状数组+思维)*
题目链接:http://codeforces.com/problemset/problem/799/C#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x...原创 2018-09-26 18:57:24 · 111 阅读 · 0 评论 -
NewCoder 多校1 J Different Integers (树状数组+贡献思维)
题目链接:https://www.nowcoder.com/acm/contest/139/J#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,y) ...原创 2018-10-01 15:58:49 · 138 阅读 · 0 评论 -
HDU 4456 Crowd (二维树状数组+哈希离散化+坐标转化)*
题目大意:http://acm.hdu.edu.cn/showproblem.php?pid=4456#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x...原创 2018-09-28 21:07:56 · 258 阅读 · 0 评论 -
HDU 1394 Minimum Inversion Number (树状数组+递推)*
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1394#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x...原创 2018-10-08 18:49:10 · 68 阅读 · 0 评论 -
HDU 4991 Ordered Subsequence (树状数组+离散化)水
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4991#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x...原创 2018-10-09 09:37:18 · 143 阅读 · 0 评论 -
HDU 6102 GCDispower (花样容斥+DP思维+树状数组维护)*
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6102#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x...原创 2018-10-25 20:25:37 · 156 阅读 · 0 评论 -
HDU 6203 ping ping ping (在线倍增lca+DFS序+树状数组)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6203#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll uns...原创 2018-11-17 15:50:52 · 182 阅读 · 0 评论 -
HDU 5875 AnInteresting game(树状数组思维题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5975#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll lon...原创 2019-01-19 23:23:08 · 140 阅读 · 0 评论 -
Gym 101147F Bishops Alliance (树状数组+DP)
题目链接:http://codeforces.com/gym/101147/problem/F#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long lon...原创 2019-01-21 20:33:07 · 132 阅读 · 0 评论 -
HDU 5877 Weak Pair (树状数组+DFS)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5877#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll lon...原创 2019-02-05 22:14:32 · 90 阅读 · 0 评论 -
Codeforces Round #537 (Div. 2) E. Tree(DP+树状数组统计+LCA)*
题目链接:http://codeforces.com/contest/1111/problem/E题目大意:给定一棵树,和若干个询问,k,m,r和k个数,问把这k个点分成至多m组且每组中的点集没有父节点与子节点的关系,其方案数有多少种。题目分析: 这道题我是看了别人的思路才懂的,果然还是自己太弱了呀。。。先简化问题,如果根是固定的如何考虑,那么观察到m的数据范围去...原创 2019-02-24 18:28:58 · 157 阅读 · 0 评论 -
HDU 6514 Monitor(二维差分+前缀和)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6514题目大意给定一个二维平面范围,和p个监视区,q个偷盗区,监视区和偷盗区形状是矩形,q个询问问偷盗区是否被监控去完全覆盖.题目分析二维差分,蛮套路的,如果知道一维的情况那么二维不难,比如(x,y),(p,q)给定这两个坐标点,那么我们要想让这个矩形区域...原创 2019-04-20 08:20:19 · 305 阅读 · 0 评论 -
HDU 4638 Group (树状数组+离线处理+思维)*
题目大意:http://acm.hdu.edu.cn/showproblem.php?pid=4638#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,...原创 2018-09-15 08:03:59 · 112 阅读 · 0 评论 -
BZOJ 3529 数表 (莫比乌斯反演+树状数组)*
题目链接:https://cn.vjudge.net/problem/HYSBZ-3529#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,y) sc...原创 2018-09-14 19:10:55 · 183 阅读 · 0 评论 -
Codeforces 369E Valera and Queries(树状数组+离线查询) *
Valera loves segments. He has recently come up with one interesting problem.The Ox axis of coordinates has n segments, the i-th segment starts in position li and ends in position ri (we will mark it...原创 2018-08-18 05:44:01 · 201 阅读 · 0 评论 -
HDU 5775 Bubble Sort(树状数组+规律思维)
Bubble SortTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2326 Accepted Submission(s): 1134 Problem DescriptionP is a permutation of...原创 2018-08-07 23:43:22 · 197 阅读 · 0 评论 -
Codeforces 459D Pashmak and Parmida's problem(树状数组)*
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for ...原创 2018-08-03 05:47:13 · 174 阅读 · 0 评论 -
HDU 5592 ZYB's Premutation (树状数组 + 二分 )
ZYB's PremutationTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1141 Accepted Submission(s): 601 Problem DescriptionZYB has a prem...原创 2018-08-01 09:39:19 · 126 阅读 · 0 评论 -
Codeforces 597C Subsequences (二维树状数组+DP)*
For the given sequence with n different elements find the number of increasing subsequences with k + 1 elements. It is guaranteed that the answer is not greater than 8·1018.InputFirst line contain...原创 2018-08-05 15:46:53 · 189 阅读 · 0 评论 -
HDU 5700 区间交(树状数组+二分+思维)好题。。
区间交Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1424 Accepted Submission(s): 543 Problem Description小A有一个含有n个非负整数的数列与m个区间。每个区间可以表示...原创 2018-07-30 22:44:55 · 244 阅读 · 0 评论 -
牛客网多校练习赛 1 JDifferent Integers (签到题) 树状数组+技巧
链接:https://www.nowcoder.com/acm/contest/139/J来源:牛客网 题目描述Given a sequence of integers a1, a2, ..., an and q pairs of integers (l1, r1), (l2, r2), ..., (lq, rq), find count(l1, r1), count(l2, r2),...原创 2018-07-21 22:10:11 · 147 阅读 · 0 评论 -
HDU 4217 Data Structure?(二分+树状数组)
Hdu 4217 Data Structure?【二分+树状数组】2017年07月28日 16:06:04阅读数:221 Data Structure?Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 3359 ...原创 2018-07-29 23:59:58 · 181 阅读 · 0 评论 -
Codeforces 597D Subsequences (二维树状数组入门+DP优化) 高清重制版
For the given sequence with n different elements find the number of increasing subsequences with k + 1 elements. It is guaranteed that the answer is not greater than 8·1018.InputFirst line contain...原创 2018-08-31 14:50:09 · 366 阅读 · 0 评论 -
HDU 4455 Substrings (树状数组+DP)思维好题
SubstringsTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3599 Accepted Submission(s): 1105 Problem DescriptionXXX has an array of l...原创 2018-09-01 08:44:18 · 150 阅读 · 0 评论 -
51Nod - 1376 最长递增子序列的数量(树状数组+DP)*
题目链接:https://cn.vjudge.net/problem/51Nod-1376#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,y) sca...原创 2018-09-19 17:47:32 · 342 阅读 · 0 评论 -
HDU 5465 Clarke and puzzle (二维树状数组水题+基础博弈)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5465#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x...原创 2018-09-14 11:12:53 · 125 阅读 · 0 评论 -
HDU 5406 CRB and Apple (DP+树状数组)思维好题*
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5406#include<bits/stdc++.h>#pragma comment(linker,"/STACK:1024000000,1024000000")using namespace std;#define debug puts("YES");#define rep(...原创 2018-09-14 06:11:26 · 168 阅读 · 0 评论 -
Gym 100589A Queries on the Tree (树状数组+分块均摊思想)
题目链接:https://cn.vjudge.net/problem/Gym-100589A#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,y) s...原创 2018-09-13 17:20:56 · 154 阅读 · 0 评论 -
HDU 5372 Segment Game (树状数组+离散化)*
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5372#include<bits/stdc++.h>#pragma comment(linker,"/STACK:1024000000,1024000000")using namespace std;#define debug puts("YES");#define rep(...原创 2018-09-07 09:38:29 · 122 阅读 · 0 评论 -
HDU 5517 Triple (二维树状数组+数据去重+数学概念)*
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5517#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x...原创 2018-09-16 23:49:06 · 227 阅读 · 0 评论 -
ACM-ICPC 2018 徐州赛区网络预赛 徐州 H Ryuji doesn't want to study (树状数组维护前缀和)水题
题目链接:https://nanti.jisuanke.com/t/31460#include<bits/stdc++.h>#pragma comment(linker,"/STACK:1024000000,1024000000")using namespace std;#define debug puts("YES");#define rep(x,y,z) for(i...原创 2018-09-09 21:24:25 · 185 阅读 · 0 评论 -
HDU 5147 Sequence II (树状数组计数)
Sequence IITime Limit: 5000/2500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1435 Accepted Submission(s): 596 Problem DescriptionLong long ago, there i...原创 2018-09-04 12:20:50 · 266 阅读 · 0 评论 -
HDU 5493 Queue (树状数组+二分+构造思维)*
Online Judge Online Exercise Online Teaching Online Contests Exercise Author F.A.QHand In HandOnline AcmersForum | DiscussStatistical Charts Probl...原创 2018-07-29 22:13:34 · 250 阅读 · 3 评论