摘要: 线段树 阅读全文
posted @ 2023-09-03 21:50 ljfyyds 阅读(35) 评论(0) 推荐(0)
该文被密码保护。 阅读全文
posted @ 2023-08-26 08:31 ljfyyds 阅读(1) 评论(0) 推荐(0)
摘要: # H. 3.魔法传输 这道题是区间加上等差数列的修改,我们直接去修改会很难想 然后我们可以发现他这个只有单点查询,所以我们就可以这么想,类似于一个差分操作 我们在每一次操作的时候我们就直接将这个区间都加上一,然后再将右端点的后一位减去区间长度 对于每一次单点查询我们就直接对这个点进行前缀和操作即可 阅读全文
posted @ 2023-08-23 19:01 ljfyyds 阅读(76) 评论(0) 推荐(0)
摘要: # 二维前缀和和差分 ## 1.二维前缀和 ![](https://cdn.luogu.com.cn/upload/image_hosting/9ardo6x9.png) $$ s_{i,j}=s_{i-1,j}+s_{i,j-1}-s_{i-1,j-1} $$ $$ s_{x_2,y_2}-s_{ 阅读全文
posted @ 2023-08-21 11:22 ljfyyds 阅读(82) 评论(0) 推荐(0)
摘要: ## [C. 【例题3】公园遛狗](https://www.ybtoj.com.cn/contest/541/problem/3) 我们对于每一个线段树的节点,维护几个值 $sum$ 表示当前区间的区间和 $ml$ 表示最大前缀和 $mr$ 表示最大后缀和 $ans$ 表示当前区间的最大子段和 接下 阅读全文
posted @ 2023-08-18 15:49 ljfyyds 阅读(46) 评论(0) 推荐(0)
摘要: # dfs序线段树 [1.树上操作](https://www.ybtoj.com.cn/contest/541/problem/6) ### 思路 遍历一整棵树,记录一下节点 $u$ 的所对应的子树的节点数 $siz_u$ 以及 $dfs$ 序 $dfn_u$ 根据整棵树的 $dfs$ 序,我们可以 阅读全文
posted @ 2023-08-18 10:58 ljfyyds 阅读(71) 评论(0) 推荐(0)
摘要: 树上前缀和 阅读全文
posted @ 2023-08-12 21:10 ljfyyds 阅读(27) 评论(0) 推荐(0)
摘要: # [Codeforces Round 881 (Div. 3)](https://codeforces.com/contest/1857) ## [A.Array Coloring](https://www.luogu.com.cn/problem/CF1857A) ### 题目大意 [link] 阅读全文
posted @ 2023-08-08 20:24 ljfyyds 阅读(54) 评论(0) 推荐(0)
摘要: ## [A.Tales of a Sort](https://codeforces.com/contest/1856/problem/A) ### 题目大意 Alphen has an array of positive integers $a$ of length n. Alphen can pe 阅读全文
posted @ 2023-08-07 16:50 ljfyyds 阅读(62) 评论(0) 推荐(1)
摘要: # [Codeforces Round 882 (Div. 2)](https://codeforces.com/contest/1847) ## [A.The Man who became a God](https://www.luogu.com.cn/problem/CF1847A) ### 题 阅读全文
posted @ 2023-08-04 15:01 ljfyyds 阅读(51) 评论(0) 推荐(0)