摘要:
对懒标记的理解更深入了 #include<bits/stdc++.h> using namespace std; #define int long long typedef pair<int,int> PII; const int N = 1e5+10; int n,m,p; int a[N]; s 阅读全文
posted @ 2022-06-17 23:59
xhy666
阅读(53)
评论(0)
推荐(0)
摘要:
带懒标记的线段树 注意递归之前要传递懒标记 #include<bits/stdc++.h> using namespace std; #define int long long const int N = 1e5+10; int n,m; int a[N]; struct NODE{ int l,r 阅读全文
posted @ 2022-06-17 22:33
xhy666
阅读(28)
评论(0)
推荐(0)
摘要:
gcd(a1,a2,a3...an)=gcd(a1,a2-a1,a3-a2...an-an-1) 用线段树维护一个差分数组,如果要查询的区间为[l,r],那么可以依次求出: 1、[1,l]的和,即al 2、gcd[min(l+1,r),r],即gcd(al+1-al,al+2-al+1...ar-a 阅读全文
posted @ 2022-06-17 21:01
xhy666
阅读(52)
评论(0)
推荐(0)

浙公网安备 33010602011771号