
线段树
循环是人递归是神
北京邮电大学
展开
-
线段树模板
配合https://www.bilibili.com/video/av47331849食用#include<bits/stdc++.h> using namespace std;#define maxn 100000void build_tree(int arr[], int tree[], int node, int start, int end) { if (start == end) { tree[node] = arr[start]; return; }.原创 2020-06-30 21:59:23 · 207 阅读 · 0 评论 -
HDU 1698 Just a Hook
http://acm.hdu.edu.cn/showproblem.php?pid=1698题意:给一个序列,初始值都是1,有多组测试数据,每个数据序列长度为n,有m个操作,每个操作给出x,y,c,表示把[x,y]区间的值改为c,最后询问序列总和原创 2020-09-30 14:50:09 · 162 阅读 · 0 评论 -
HDU 1754 I Hate It
http://acm.hdu.edu.cn/showproblem.php?pid=1754常规线段树,将tree中的求和改成求max就行。注意输入要循环,且判断EOF#include<iostream>#include<algorithm>#include<queue>#include<cstring>#include<map>#include<unordered_map>#include<set&g.原创 2020-09-30 13:33:24 · 161 阅读 · 0 评论 -
HDU 1166 敌兵布阵
http://acm.hdu.edu.cn/showproblem.php?pid=1166常规线段树操作#include<iostream>#include<algorithm>#include<queue>#include<cstring>#include<map>#include<unordered_map>#include<set>#include<unordered_set>#原创 2020-09-30 13:31:39 · 124 阅读 · 0 评论