摘要: 搞不懂为啥这样写有问题 不就是线段树的板子吗!!! 为啥会有问题啊QAQ!!! #include<bits/stdc++.h>using namespace std; typedef long long ll; const int N = 2e5 + 7; ll a[N]; struct Tree{ 阅读全文
posted @ 2022-10-29 20:53 feuerwerk 阅读(43) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2022-10-29 19:34 feuerwerk 阅读(22) 评论(0) 推荐(0)
摘要: 水题,线段树板子(单点修改和区间和) #include<bits/stdc++.h>using namespace std; typedef unsigned long long ull; const int N = 1e5 + 7; ull a[N], tree[N * 4]; void chan 阅读全文
posted @ 2022-10-29 16:14 feuerwerk 阅读(37) 评论(0) 推荐(0)
摘要: 我靠,居然忘记怎么写单调队列了,废了废了QAQ #include<bits/stdc++.h>using namespace std; const int N = 1e6 + 7; int a[N], q[N]; int main(){ int n, k; scanf("%d%d", &n, &k) 阅读全文
posted @ 2022-10-29 15:40 feuerwerk 阅读(30) 评论(0) 推荐(0)
摘要: 线段树板子题(水题) #include<bits/stdc++.h>using namespace std; const int N = 1e5 + 7; int a[N], tree[N * 4]; void build_tree(int l, int r, int i){ if(l == r){ 阅读全文
posted @ 2022-10-29 13:36 feuerwerk 阅读(29) 评论(0) 推荐(0)
摘要: 利用大根堆和小根堆的性质,进行维护, 大根堆的元素要一直小于GET的次数(也就是i),每一次操作后都要进行大根堆的元素增加 也就是p.push(q.top()), q.pop();这一步操作!!!!! #include <bits/stdc++.h>using namespace std; cons 阅读全文
posted @ 2022-10-29 13:05 feuerwerk 阅读(27) 评论(0) 推荐(0)
摘要: 1.归并排序方法求逆对 (方法相同于P1908 逆序对) #include<bits/stdc++.h>using namespace std; const int N = 5e5 + 7; int a[N], st[N];long long ans = 0;void merge_sort(int 阅读全文
posted @ 2022-10-29 10:13 feuerwerk 阅读(48) 评论(0) 推荐(0)