摘要: 1 #include<bits/stdc++.h> 2 using namespace std; 3 vector<int>a; 4 int n; 5 int main() 6 { 7 scanf("%d",&n); 8 for(int i=1,p,nw;i<=n;++i) 9 { 10 scanf 阅读全文
posted @ 2019-11-01 21:01 月亮茶 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 一,线段树做区间乘法 首先要明白,乘法操作高于加法操作 一般的话会开long long ,要去模 对于一个节点o,我们设区间和为sum[o],加法标记为add[o],乘法标记为mul[o] mul标记的初始值是1,add标记初始值是0 在修改值的时候,add的维护需要累加,mul的维护需要累乘 此时 阅读全文
posted @ 2019-11-01 19:47 月亮茶 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 一,什么是线段树 线段树是一种二叉搜索树,它将一个区间划分成一些单元区间 每个单元区间对应线段树中的一个叶结点 将[1,n]分解成若干特定的子区间(数量不超过4*n) 用线段树对“编号连续”的一些点,进行修改或者统计操作,修改和统计的复杂度都是O(log2(n)) 用线段树统计的东西,必须符合区间加 阅读全文
posted @ 2019-11-01 18:58 月亮茶 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 1 题目描述 2 Bessie is leading the cows in an attempt to escape! To do this, the cows are sending secret binary messages to each other. 3 Ever the clever 阅读全文
posted @ 2019-11-01 18:35 月亮茶 阅读(278) 评论(0) 推荐(0) 编辑