题解atcoder agc 004

AtCoder Beginner Contest 294 E

# [AtCoder Beginner Contest 294](https://atcoder.jp/contests/abc294) ## E - 2xN Grid ### Problem Statement 题意:给你$2$行长度为$L$的矩阵。告诉你格子里面的数字,以$vi$ $li$的形式 ......
Beginner AtCoder Contest 294

AtCoder Beginner Contest 302 ABCDEF

# [AtCoder Beginner Contest 302](https://atcoder.jp/contests/abc302) ## **A - Attack** ### Problem Statement 题意:敌人有$A$的耐力值,每次攻击敌人可以减少$B$的耐力值,问多少次敌人耐力值 ......
Beginner AtCoder Contest ABCDEF 302

AtCoder Beginner Contest 305 ABCDE

# [AtCoder Beginner Contest 305](https://atcoder.jp/contests/abc305) ## A - Water Station ### Problem Statement 题意:水站每$5km$设一个,给你一个$N$ $km$的位置,问你离它最近的 ......
Beginner AtCoder Contest ABCDE 305

AGC019F Yes or No

## 题意 有 $N+M$ 个问题,其中有 $N$ 个问题的答案是 `YES`,$M$ 个问题的答案是 `NO`。当你回答一个问题之后,会知道这个问题的答案,求最优策略下期望对多少。答案对 $998244353$ 取模。 ## 题解 首先每次必定去猜那个个数更多的问题。用点 $(x, y)$ 表示剩 ......
019F AGC 019 Yes No

P1903 [国家集训队] 数颜色 / 维护队列 题解

一、题目描述: 给你一个长度为 $n$ 的序列 $a$ , 你需要进行 $m$ 次操作。 $类型\ 1\ : 将第\ x\ 个元素的值修改为\ v\ 。$ $类型\ 2\ : 求区间\ l\ 到\ r\ 中有多少种数字。$ 数据范围:$1 \le n,m \le 1333333,所有数字 \le 1 ......
集训队 题解 队列 颜色 国家

NOIP2020 T2 字符串匹配【题解】

# NOIP2020 T2 字符串匹配 ### 首先声明 这篇题解存在大多数让我这种人看懂的废话,如果想要速通,请另寻他解 ## 题目简化 定义字符串乘法为 $AB$ 为把两个字符串拼起来,定义阶乘 $A^i$ 表示 $\prod_{1}^i A$ 再定义 $F(S)$ 为 $S$ 中出现奇数次字符 ......
题解 字符串 字符 NOIP 2020

AtCoder Beginner Contest 275 G Infinite Knapsack

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc275_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc275/tasks/abc275_g "AtCoder 传送门") 原问题等价于: > ......
Beginner Infinite Knapsack AtCoder Contest

CF1205C Palindromic Paths 题解

妈的,给虹夏可爱完了!人活着哪有不喜欢虹夏的,硬撑罢了!忍不了,一拳把下北泽打爆!人活着哪有不喜欢虹夏的,硬撑罢了!忍不了,一拳把下北泽打爆!人活着哪有不喜欢虹夏的,硬撑罢了!忍不了,一拳把下北泽打爆!人活着哪有不喜欢虹夏的,硬撑罢了!忍不了,一拳把下北泽打爆!彻底疯狂!彻底疯狂 ......
题解 Palindromic 1205C Paths 1205

「ULSG-1」2048 题解

[题目传送门](https://www.luogu.com.cn/problem/T330941?contestId=105788) ### 题目解析 玩一次就明白了。 [传送门](https://cyberzhg.github.io/2048/index.html?size=4&mode=norm ......
题解 ULSG 2048

「ULSG-1」数字生命 题解

[题目传送门](https://www.luogu.com.cn/problem/T326519?contestId=105788) ### 题目描述 给定一段长度为 $n$ 的序列,找出其中长度为 $m$ 的一段子序列,且其中各数字出现次数与给定模板中相对应的次数不相同的数字**等于** $k$。 ......
题解 生命 数字 ULSG

「ULSG-1」泡水的铅筒 题解

[题目传送门](https://www.luogu.com.cn/problem/T341351?contestId=105788) ### 题目描述 一个圆锥放入一个长方体水池中,无水溢出,求长方体液面高度的最大、最小值。 ### 解题思路 ~~如果这个题只有一个数据点,此数据点只有一组数据,那这 ......
题解 ULSG

「SiR-1」Checkmate 题解

#### 题外话:本体题目出自番剧《NO GAME NO LIFE》且题目背景中 >来吧,游戏开始了。 #### 是第一季中男主“空”的口头禅。(强烈推荐观看《NO GAME NO LIFE ZERO》) #### ~~回归正题awa~~ ## P9355「SiR-1」Checkmate 题解 [题 ......
题解 Checkmate SiR

【BZOJ 3156】防御准备 题解

[原题](https://hydro.ac/d/bzoj/p/3156) 令$S_{i} =\sum_{j=1}^{i}j$ , $f_{i}$ 为处理到第 $i$ 个位置放置守卫塔的最小花费。 观察题意,容易得到在$(1 using namespace std; #define ll long l ......
题解 BZOJ 3156

AtCoder Beginner Contest 253 Ex We Love Forest

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc253_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc253/tasks/abc253_h "AtCoder 传送门") 没做出来。 考虑求 ......
Beginner AtCoder Contest Forest Love

AtCoder Beginner Contest 298 Ex Sum of Min of Length

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc298_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc298/tasks/abc298_h "AtCoder 传送门") 挺无脑的。是不是因 ......
Beginner AtCoder Contest Length of

AtCoder Beginner Contest 251 G Intersection of Polygons

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc251_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc251/tasks/abc251_g "AtCoder 传送门") 经典结论,一个点 ......

AtCoder Beginner Contest 220 G Isosceles Trapezium

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc220_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc220/tasks/abc220_g "AtCoder 传送门") 简单题。 首先肯定 ......
Isosceles Trapezium Beginner AtCoder Contest

[ABC114D] 756 题解

[题目链接](https://atcoder.jp/contests/abc114/tasks/abc114_d) ## 题意 给定一个数 $n$,求 $n!$ 的因数中,刚好有 $75$ 个因数的数的个数。 ## 分析 首先有这样一个性质,对于一个数 $a$,我们将其分解质因数,即 $$a = \ ......
题解 114D ABC 114 756

Alien 的排列题解

## Description 求出有多少 $2\sim n+1$ 的排列 $\{P_{n}\}$,使得对于所有 $1\leq i\leq n$ 有 $i|P_{i}$。 对于 $30\%$ 的数据 $n\leq 10$。 对于 $90\%$ 的数据 $n\leq 3000$。 对于 $100\%$ ......
题解 Alien

[ZJOI2022] 深搜 题解

## 题目描述 九条可怜是一个喜欢算法的女孩子,在众多算法中她尤其喜欢深度优先搜索(DFS)。 有一天,可怜得到了一棵有根树,树根为 $\mathit{root}$,树上每个节点 $x$ 有一个权值 $a_x$。 在一棵树上从 $x$ 出发,寻找 $y$ 节点,如果使用深度优先搜索,则可描述为以下演 ......
题解 ZJOI 2022

P2801 教主的魔法 题解

一、题目描述: 给你一个长度为 $n$ 的序列 $a$ , 你需要进行 $m$ 次操作。 $类型\ 1\ : 将区间\ l\ 到\ r\ 的数加\ x\ 。$ $类型\ 2\ : 求区间\ l\ 到\ r\ 中有多少个数大于等于\ x\ 。$ 数据范围:$1 \le n \le 1\times 10 ......
题解 教主 魔法 P2801 2801

AtCoder Beginner Contest 227 E Swap

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc227_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc227/tasks/abc227_e "AtCoder 传送门") 感觉是很裸的题。 ......
Beginner AtCoder Contest Swap 227

Educational Codeforces Round 150 (Rated for Div. 2)题解(A~D)

比赛地址 A. Game with Board 题意: 给出一个包含n个1的数组,Alice和Bob轮流操作(Alice先手),每次操作可以将若干个(最少为两个)不同的元素相加,组成一个新的元素插入数组中,同时删去被操作的元素。当轮到某名玩家时无法再进行操作,则该玩家获胜。 思路: 容易想到,当n= ......
题解 Educational Codeforces Round Rated

AtCoder Beginner Contest 249 G Xor Cards

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc249_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc249/tasks/abc249_g "AtCoder 传送门") 好题。 套路地,考 ......
Beginner AtCoder Contest Cards 249

[AGC038C] LCMs

## 题目描述 - 给定一个长度为 $N$ 的数列 $A_1, A_2, A_3, \ldots, A_N$。 - 请你求出 $\sum_{i=1}^{N}\sum_{j=i+1}^{N}\mathrm{lcm}(A_i,A_j)$ 的值模 $998244353$ 的结果。 - $1 \leq N ......
038C LCMs AGC 038

『题解』BZOJ2839 集合计数

# 西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内西内呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃啊啊啊啊啊啊啊啊啊啊啊啊啊 ......
题解 BZOJ 2839

[SCOI2010] 连续攻击游戏-题解

## 题目描述 $\text{lxhgww}$ 最近迷上了一款游戏,在游戏里,他拥有很多的装备($n \le 10^6$),每种装备都有 $2$ 个属性,这些属性的值用 $[1,10000]$ 之间的数表示。 当他使用某种装备时,他只能使用该装备的某一个属性。并且每种装备最多只能使用一次。 游戏进行 ......
题解 SCOI 2010

AtCoder Beginner Contest 305 题解 A - F

## [A](https://atcoder.jp/contests/abc305/tasks/abc305_a) - Water Station ### 题目大意 找到离给定的数最近的一个 $5$ 的倍数输出即可。 ### 解题思路 我们取这个数对 $5$ 的上下界,也就是整数除以 $5$ 再乘以 ......
题解 Beginner AtCoder Contest 305

AtCoder Beginner Contest 219 H Candles

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc219_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc219/tasks/abc219_h "AtCoder 传送门") 套路化了。 比较显 ......
Beginner AtCoder Contest Candles 219

题解 ABC207F【Tree Patrolling】

挺简单的树上背包,就是有点难写。 设 ${dp}_{u,i,x,y}$ 表示仅考虑 $u$ 的子树内,有 $i$ 个节点被控制,$x$ 为节点 $u$ 是否有警卫,$y$ 为节点 $u$ 是否被控制。(其实所有 $x=1,y=0$ 的状态都没用,但我懒得管了。) 每个点 $u$ 的初始值为 ${dp ......
题解 Patrolling 207F Tree ABC