![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
线段树
rainbowsea_1
难得有了目标,怎么可以还是烂人一条!
展开
-
主席树模板题
20浙江省赛 链接 ps:不是题解,只是记录 主席树还是很有意思的嘛~ 题意: 题解 根据题目dp的方向,直接判断出最后答案为1到(r−l+1)的平方和加上l到r区间前k大的值 #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5 + 10; struct node { int l, r; int cnt; ll sum; } tr[N * 4 + N原创 2021-07-29 10:44:01 · 66 阅读 · 0 评论 -
UVA-11990(线段树)
题目链接:https://vjudge.net/problem/UVA-11990 过几天我再来写题解 #include<map> #include<set> #include<cmath> #include<queue> #include<stack> #include<vector> #include<cstdio&...原创 2020-05-04 19:18:33 · 134 阅读 · 0 评论 -
Frequent values POJ - 3368(线段树)
Frequent values POJ - 3368 You are given a sequence of n integers a1 , a2 , … , an in non-decreasing order. In addition to that, you are given several queries consisting of indices i and j (1 ≤ i ≤ j ...原创 2020-04-24 00:18:41 · 150 阅读 · 0 评论 -
线段树的两种表示(收藏)
一、 注释版 void build(int x,int l,int r) { if (l == r) { tree[x] = b[l]; return; } int mid = (l + r) / 2; build(x<<1, l, mid); build(x<<1|1, mid + 1, r); ...原创 2020-04-23 22:24:53 · 98 阅读 · 0 评论