摘要: 原题链接 题解 标准的线段树加上一点点题意转化,注意细节 code #define ll long long #include<bits/stdc++.h> using namespace std; ll tree[810000]; ll wait[810000]; inline void read 阅读全文
posted @ 2024-02-20 23:44 纯粹的 阅读(22) 评论(0) 推荐(0)
摘要: 原题链接 题解 区间修改+单点查询 对于一个点,查询的时候翻转的次数如果是奇数,是1,如果是偶数,是0 所以题目转变成对区间上的点加一,然后求单点的奇偶性 树状数组 对一串序列加1,相当于对其差分序列的 \([l]++,[r+1]--\) code #include<bits/stdc++.h> u 阅读全文
posted @ 2024-02-20 22:44 纯粹的 阅读(21) 评论(0) 推荐(0)
摘要: 原题链接 题解 多次单点修改加上多次区间查询 线段树 code #include<bits/stdc++.h> using namespace std; int tree[800005]={0}; int a[200005]={0}; void build(int node,int l,int r) 阅读全文
posted @ 2024-02-20 21:20 纯粹的 阅读(18) 评论(0) 推荐(0)
摘要: 原题链接 code #define ll long long #include<bits/stdc++.h> using namespace std; ll tree[410000]={0}; ll wait_mul[410000]={0}; ll wait_add[410000]={0}; ll 阅读全文
posted @ 2024-02-20 20:25 纯粹的 阅读(20) 评论(0) 推荐(0)
摘要: 原题链接 题解 一开始我想的是每个节点要么建,要么不建,可是这样一来不好转移,因为有如下情况(黑色代表建站) 于是我们换一个角度思考,我们发现一个点要能通网,有三种情况: 1.自己建站 2.儿子建站 3.父亲建站 Code #define ll long long #include<bits/std 阅读全文
posted @ 2024-02-20 17:15 纯粹的 阅读(28) 评论(0) 推荐(0)
摘要: 原题链接 题解 细节很多的树形dp,请看代码 code #define ll long long #include<bits/stdc++.h> using namespace std; ll sit[100005]={0}; ll f[100005]={0}; vector<ll> G[10000 阅读全文
posted @ 2024-02-20 14:22 纯粹的 阅读(20) 评论(0) 推荐(0)
摘要: 原题链接 题解,请看这里 细节 有除法的求模要求逆元 code #include<bits/stdc++.h> #define mod 998244353 #define ll long long using namespace std; inline void read(ll &x) { x = 阅读全文
posted @ 2024-02-20 05:21 纯粹的 阅读(37) 评论(0) 推荐(0)