线段459579152 zhuanlan atcoder

AtCoder Beginner Contest 240 D

[**D - Strange Balls**](https://atcoder.jp/contests/abc240/tasks/abc240_d) tag:栈模拟 发现自己隔了快半年再做此题看错相同数字的球消失的条件,不是 $k \geq 2$ 而是 $k = a_i$ ~~电子竞技不需要视力~~ ......
Beginner AtCoder Contest 240

线段树合并学习笔记

## 前言 我是一个什么什么傻卵啊啊啊啊啊啊啊啊,连线段树合并都学不明白qaq ## 正文 ### 权值线段树 #### 含义: > 是用来维护好多好多桶的线段树. 桶是一个用来计数的东西. #### 与普通线段树的区别 > 普通线段树是用来维护区间和、积、最值等一系列的东西. > 权值线段树是用来 ......
线段 笔记

AtCoder Beginner Contest 304 G Max of Medians

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc304_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc304/tasks/abc304_g "AtCoder 传送门") 首先显然二分答案, ......
Beginner AtCoder Contest Medians 304

AtCoder Beginner Contest 150 E Change a Little Bit

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc150_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc150/tasks/abc150_e "AtCoder 传送门") 令 $S_i \g ......
Beginner AtCoder Contest Change Little

Atcoder-AGC033C

看到这道题,是个博弈论,没见过树上的,于是想到在数列里的博弈论,又联想到树的特殊形式————链。 于是我们来讨论一下链的情况(对于没有硬币的点,我们就视为它被删掉了): 讨论链的情况 发现若是选择两端的点,顶点数会减一;若是选择中间的点,顶点数会减二。 现在我们站在链的角度来思考在树上选择的情况,一 ......
Atcoder-AGC Atcoder AGC 033

蓝桥杯----线段树训练

在来看下multiset的使用: 我们知道multiset是默认从小到大排序,那么如果我们想从大到小排序应该如何办? greater<int>是用来指定从大到小排序的 《线段树 维护区间第k大》 好博客< 由于这个第k大的k比较小,而且只有单点修改,那么我们可以用线段树 树中的每一个节点都维护着一个 ......
蓝桥 线段

题解 P4556 [Vani有约会]雨天的尾巴 /【模板】线段树合并

[传送门](https://www.luogu.com.cn/problem/P4556) 如题目所言,这就是个线段树合并的板子题。 ## 题目大意 ### 题目描述 首先村落里的一共有 $n$ 座房屋,并形成一个树状结构。然后救济粮分 $m$ 次发放,每次选择两个房屋 $(x, y)$,然后对于 ......
线段 题解 雨天 尾巴 模板

Luogu P4556 [Vani有约会]雨天的尾巴 /【模板】线段树合并

# [Vani有约会]雨天的尾巴 /【模板】线段树合并 ## 题目背景 深绘里一直很讨厌雨天。 灼热的天气穿透了前半个夏天,后来一场大雨和随之而来的洪水,浇灭了一切。 虽然深绘里家乡的小村落对洪水有着顽固的抵抗力,但也倒了几座老房子,几棵老树被连根拔起,以及田地里的粮食被弄得一片狼藉。 无奈的深绘里 ......
线段 雨天 尾巴 模板 Luogu

AtCoder Beginner Contest 149 F Surrounded Nodes

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc149_f "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc149/tasks/abc149_f "AtCoder 传送门") 不错的题。 考虑题 ......
Surrounded Beginner AtCoder Contest Nodes

Codeforces 1566G - Four Vertices(线段树分治)

交了整整 2 页,本来想用随机化卡过去的,后来发现我的实现跑得太慢就写正常做法了。 首先发现最优答案对应的四个点只可能有以下两种可能: - $a,b$ 间有边,$c,d$ 间有边,此时答案是 $a,b$ 边权值加 $c,d$ 边权值。 - $a$ 与 $b,c,d$ 三个点间都有边,此时答案是三条边 ......
线段 Codeforces Vertices 1566G 1566

动态开点线段树

```cpp template struct Node { int l, r; T sum; // 区间和 T addtag; // 加法懒标记 // 左右子节点 Node *left, *right; Node(int l_, int r_, T sum_) : l(l_), r(r_), sum ......
线段 动态

AtCoder Beginner Contest 225 F String Cards

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc225_f "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc225/tasks/abc225_f "AtCoder 传送门") 这题是真的强。。 ......
Beginner AtCoder Contest String Cards

AtCoder Beginner Contest 225 G X

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc225_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc225/tasks/abc225_g "AtCoder 传送门") 感觉是一种很新的建 ......
Beginner AtCoder Contest 225

AtCoder Beginner Contest 281 Ex Alchemy

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc281_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc281/tasks/abc281_h "AtCoder 传送门") 考虑设 $f_i$ ......
Beginner AtCoder Alchemy Contest 281

AtCoder Beginner Contest 287 G Balance Update Query

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc287_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc287/tasks/abc287_g "AtCoder 传送门") 线段树上二分入门题 ......
Beginner AtCoder Balance Contest Update

AtCoder Beginner Contest 258 G Grid Card Game

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc259_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc259/tasks/abc259_g "AtCoder 传送门") 记 $b_i = ......
Beginner AtCoder Contest Card Grid

「学习笔记」线段树

## 介绍: 线段树是一棵二叉搜索树,思想与分治很想,把一段区间平分平分再平分,平分到不能平分为止,可以进行方便的区间修改和区间查询,当然,树状数组能做的单点修改、单点查询,线段树也可以更好地实现,总之,线段树是树状数组的升级版,此外,线段树能做的平衡树也能做,但平衡树码量太大,考场上一般写不出来~ ......
线段 笔记

AtCoder Regular Contest 145

### [A](https://atcoder.jp/contests/arc145/tasks/arc145_a) 答案为 `Yes` 当且仅当 $s[1] \ne $ `A` 或 $s[n] \ne $ `B`。 注意判 $n = 2$。 ### [B](https://atcoder.jp/c ......
AtCoder Regular Contest 145

AtCoder Beginner Contest 304 ABCDE

[AtCoder Beginner Contest 304](https://atcoder.jp/contests/abc304) ![image](https://img2023.cnblogs.com/blog/2458891/202306/2458891-20230604120319565- ......
Beginner AtCoder Contest ABCDE 304

AtCoder Beginner Contest 304

## [A - First Player (abc304 a)](https://atcoder.jp/contests/abc304/tasks/abc304_a) ### 题目大意 依次给定每个人的姓名和年龄,排成一圈。从年龄最小的人依次输出姓名。 ### 解题思路 找到年龄最小的,依次输出就好 ......
Beginner AtCoder Contest 304

AtCoder Beginner Contest 214 H Collecting

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc214_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc214/tasks/abc214_h "AtCoder 传送门") 好毒瘤啊…… 首先 ......
Collecting Beginner AtCoder Contest 214

线段树模板题

[TOC] . ## 洛谷3372 线段树区间加法/区间求和 ```C++ // by DTTTTTTT 2023/6/2 // Luogu 3372 #include #define ll long long #define lc (p> 1; build(lc, l, mid); build(r ......
线段 模板

AtCoder Beginner Contest 286(G)

# AtCoder Beginner Contest 286(G) ## G(欧拉路径) [G](https://atcoder.jp/contests/abc286/tasks/abc286_g) 题意大致为$n$个点,$m$个边的图,然后给出$k$条边的编号,问我们这$k$条边可不可以在一条路径 ......
Beginner AtCoder Contest 286

AtCoder Beginner Contest 287(C,D,E,F)

# AtCoder Beginner Contest 287(C,D,E,F) ## C (图) [C](https://atcoder.jp/contests/abc287/tasks/abc287_c) 题目大意为$n$个点,$m$条边,问是否这个图是一条长度为$n$的链 这个就直接判断每个点的 ......
Beginner AtCoder Contest 287

Codeforces 1515I - Phoenix and Diamonds(值域倍增+线段树)

首先 $c$ 很大,因此复杂度跟 $c$ 有关的项肯定只能是 $\log c$ 之类的。 类比 IOI2021 dungeons 的套路,我们**对值域进行分层**,假设 $c\in[2^{\omega-1},2^{\omega})$,考虑令重量在 $\ge 2^{\omega-1}$ 的物品为“重 ......
值域 线段 Codeforces Diamonds Phoenix

AtCoder Beginner Contest 214 G Three Permutations

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc214_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc214/tasks/abc214_g "AtCoder 传送门") 比较平凡的一个容斥 ......
Permutations Beginner AtCoder Contest Three

CF101234A Hacker Cups and Balls【二分+线段树】

## Description 给一个长度为 n 的排列,对它做 m 次操作,每次对 [l, r] 区间内进行升序/降序排序。 问最后的序列处于最中心的数是多少(n为奇数)。 ## Solution 是一类没有写过的题,[参考题解](https://www.cnblogs.com/ShinaCloud ......
线段 101234A 101234 Hacker Balls

AtCoder Beginner Contest 247 Ex Rearranging Problem

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc247_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc247/tasks/abc247_h "AtCoder 传送门") 考虑我们如何判定一 ......
Rearranging Beginner AtCoder Contest Problem

AtCoder Beginner Contest 303

# **A - Similar String** ```cpp #include using namespace std; #define int long long int32_t main() { int n; string s , t; cin >> n >> s >> t; for( int ......
Beginner AtCoder Contest 303

AtCoder Beginner Contest 213 H Stroll

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc213_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc213/tasks/abc213_h "AtCoder 传送门") 考虑一个朴素 dp ......
Beginner AtCoder Contest Stroll 213