colorful 133f tree abc
[ABC314E]
# [**[ABC314E] Roulettes**](https://www.luogu.com.cn/problem/AT_abc314_e) 令 $f_i$ 表示现在已经有 $i$ 分,要达到 $m$ 分需要的最小期望代价。 答案为 $f_0$。 $\Large f_x=\min_{i=1}^ ......
[ABC313E]
# [**[ABC313E] Duplicate**](https://www.luogu.com.cn/problem/AT_abc313_e) https://www.luogu.com.cn/blog/zyc139449/solution-abc313-e # [AC](https://www ......
[刷题笔记] [【LGR-155-Div.3】T4] Luogu P9572 「NnOI R2-T4」Colorful Days♪
[Problem](https://www.luogu.com.cn/problem/P9572) ### Description 有两个数组 $A,B$ ,我们可以将 $A$ 数组无限次重复拼接。求最少需要多少次拼接使得拼接后的 $A,B$ 的最长公共子序列最大。 ### Analysis 我们要 ......
[ABC297G] Constrained Nim 2 题解
## 题意 有 $N$ 堆石子,其中第 $i$ 堆有 $A_i$ 个石子。每次可以选一堆从中取 $\left[L, R\right]$ 个,问判断先手后手胜负。 ($1 \le N \le 2 \times 10^5, 1 \le L \le R \le 10^9, 1 \le A_i \le 10 ......
Tree-shaking
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 1384 bytes (99.9% reduction). Tree-shaking can be disabled by prov ......
题解 CF1218D【Xor Spanning Tree】
萌萌 FWT 题。 仙人掌满足任意一条边只在至多一个环上,因此要求生成树,只需要每个环断一条边即可。显然生成树上边权异或和等于所有边异或和再异或上所有断的边。 设所有边异或和为 $s$,第 $i$ 个环上有 $c_{i,j}$ 条边权为 $j$ 的边。 令 $F_0(z)=[z=s]$,$F_i(z ......
ABC351D_MagicalCookies
# [**Magical Cookies**](https://atcoder.jp/contests/abc315/tasks/abc315_d) 根据问题的描述,如果在判断同一行或同一列的所有饼干是否具有相同颜色时,选择了时间复杂度为 $\Theta(H)$ 或 $\Theta(W)$ 的方法, ......
ABC315
## T1: [tcdr](https://atcoder.jp/contests/abc315/tasks/abc315_a "tcdr") 模拟 代码实现 ``` #include using namespace std; int main() { string s; cin >> s; era ......
P9572 Colorful Days♪
[原题链接](https://www.luogu.com.cn/problem/P9572 "原题链接") ## 题目大意: 有两个数组$S$,$T$,你可以把S进行复制并接到其后面形成$S^k$,如$S$=`123`,则$S^2$=`123123`,$S^3$=`123123123` 让你求出$S ......
三个协程实现,异步交替打印abc
package main import ( "fmt" ) func printLetter(ch chan bool, letter string, nextCh chan bool, done chan bool) { for i := 0; i < 5; i++ { <-ch fmt.Prin ......
[AT_ABC106_C]题解(C++)
## Part I Preface - [原题目$\text{(Luogu)}$](https://www.luogu.com.cn/problem/AT_abc106_c) - [原题目$\text{(AtCoder)}$](https://www.luogu.com.cn/remoteJudge ......
[AT_ABC106_D]题解(C++)
## Part I Preface - [原题目$\text{(Luogu)}$](https://www.luogu.com.cn/problem/AT_abc106_c) - [原题目$\text{(AtCoder)}$](https://www.luogu.com.cn/remoteJudge ......
[AT_ABC106_B]题解(C++)
## Part I Preface - [原题目$\text{(Luogu)}$](https://www.luogu.com.cn/problem/AT_abc106_b) - [原题目$\text{(AtCoder)}$](https://www.luogu.com.cn/remoteJudge ......
[AT_ABC106_A]题解(C++)
## Part I Preface - [原题目$\text{(Luogu)}$](https://www.luogu.com.cn/problem/AT_abc106_a) - [原题目$\text{(AtCoder)}$](https://www.luogu.com.cn/remoteJudge ......
sol. ABC246Ex
动态 DP 模板题 [[ABC246Ex] 01? Queries](https://atcoder.jp/contests/abc246/tasks/abc246_h) 题目大意:给定一个长度为 $N$ 且只包含 ```?```,```1```,```0``` 的字符串 $a$。$Q$ 次操作,每 ......
Atcoder_[abc284E]Count Simple Paths题解
[题目链接](https://www.luogu.com.cn/problem/AT_abc284_e) 这题就是很简单的图上深搜,我觉得放在E题太水了,代码里有详细注释。 ```cpp #include using namespace std; #define int long long vect ......
AT_abc182_e [ABC182E] Akari题解
#### [题目链接](https://www.luogu.com.cn/problem/AT_abc182_e) ## 思路 说实话,这道题其实算模拟,还是挺简单的那种。我们可以定一个 int 类型的二维数组,表示网格。通过不同的数字来表示该方格内不同的类型。然后,使用枚举法模拟网格内灯泡从**上 ......
[ARC117D] Miracle Tree
### 题目大意 给定一棵 $n$ 个节点的树,要求构造出一个点权序列 $E$,满足以下三个条件: 1. 所有 $E_i\ge 1(1\le i\le n)$。 2. 对于任意一组 $(i,j)(1 ≤ i using namespace std; const int N = 200500; vec ......
[ARC117D] Miracle Tree 题解
## 题意 给定一棵 $n$ 个节点的树,要求构造出一个点权序列 $E$,满足以下三个条件: 1.所有 $E_i\ge 1(1\le i\le n)$。 2.对于任意一组 $(i,j)(1 ≤ i typedef int valueType; typedef std::vector ValueVec ......
ABC 313
现在在做 Ex,等会更。 前三题太简单,DE 挺好玩,FGH 赛时不会。 ## D 先求出 $1$ 和其他数的异或值,再计算。 ## E 连续两个 $>1$ 不会结束,其他的情况从后往前处理即可。 ## F 妙妙题。等会更。 ## G 如果知道 ACL/会类欧 就是简单题。等会更。 ## Ex 应该 ......
杭电23多校第九场Capoo on tree(二分+树链剖分+可持久化线段树)
## 2023HDU多校9__Capoo on tree(二分+树链剖分+可持久化线段树) ### [题目链接](http://acm.hdu.edu.cn/showproblem.php?pid=7371) ### Solution $Hint1$ 考虑如何进行对某一相同点权的所有点进行点权$+1 ......
D. Trees and Segments
D. Trees and Segments The teachers of the Summer Informatics School decided to plant $n$ trees in a row, and it was decided to plant only oaks and fir ......
spring注入bean错误-Bean named 'abc' is expected to be of type 'AAA' but was actually of type 'BBB'
@Resource注解有两个重要的属性:name和type。在一个使用@Resource来注入bean的声明语句中,@Resource优先是按name来解析bean的 ......
CF1844G Tree Weights
[题面传送门](https://www.luogu.com.cn/problem/CF1844G) 这个真的很容易想到吗? 首先定 $1$ 为根,设每个点的深度是 $d_i$,则两个点之间的距离是 $d_{i}+d_{i+1}-2d_{LCA(i,i+1)}$。题目中相当于给出了 $n-1$ 个方程 ......
AtCoder-ABC-309 C - Medicine
# [C - Medicine](https://atcoder.jp/contests/abc309/tasks/abc309_c) ## 题目大意: 给 n 种药,第 i 种药吃 $a_i$ 天,每天 $b_i$ 粒。问最早在第几天,当天要吃的药 ≤ K 。 $1 数组,储存 。数组大小为 n ......
AtCoder-ABC-267 C - Index × A(Continuous ver
# [C - Index × A(Continuous ver.)](https://atcoder.jp/contests/abc267/tasks/abc267_c) ## 题目大意: 给定n个数($a_1,a_2...a_n$),从中选连续m个数,这m个数的和为:$\sum_{i=1}^mi* ......
二叉搜索树(BST,binary search tree)
对于静态查找可以用二分查找,将查找时间复杂度降到 log2 n 。其中,虽然数据存储在线性的结构里,但我们事先对数据进行了处理,在查找的顺序过程中运用到判定树这样的结构,将线性上的查找过程转变为了在类似树上面的查找过程,其查找的效率就是树的高度。但如果查找的集合不仅有查找还有删除新增的需求,而树具有 ......
(离线做法)ABC133F 题解
### (离线做法)ABC133F 题解 题目链接:[ABC133F](https://www.luogu.com.cn/problem/AT_abc133_f) #### 明确维护目标 显然我强制修改强制查询的在线做法会超时,于是我考虑离线做法。 首先我们可以知道,树上的路径可以用和差关系线性表示 ......
CodeForces 1858D Trees and Segments
[洛谷传送门](https://www.luogu.com.cn/problem/CF1858D "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1858/D "CF 传送门") 美丽度的式子可以写成 $(a - 1) \tim ......