vertices strong 1857d cf

CF1374E2 Reading Books(hard version) 题解

# CF1374E2 Reading Books(hard version) 这道题是在 [CF1374E1 Reading Books(easy version)](https://www.luogu.com.cn/problem/CF1374E1) 的基础上出的,而且仅仅增加了一个 $m$ 的限 ......
题解 Reading version 1374E Books

[题解] CF1328E Tree Queries

# CF1328E Tree Queries ## 题意 给定一棵以 $1$ 为根节点的有根树。 现在有 $q$ 次询问,每次询问给定 $m$ 个节点,问是否存在一条从根节点开始的链,使得每个节点到这条链的距离不超过 $1$ 。 ## 思路 我们首先可以给出一个结论:如果节点 $v$ 与一条链的距离 ......
题解 Queries 1328E 1328 Tree

CF1835 题解

# CF1835 题解 ### A 考虑到 $a,b,c > 3$ 的最多只有 $5$ 个,可以直接循环枚举 $A$ 。首先将 $B$ 取到最小值,然后判断 $C$ 是否达到了最小值,如果没有就将 $B$ 和 $C$ 同时补齐。此时特判如果 $C$ 大于上限(就是 $\geq 10^{c}$ ),就 ......
题解 1835 CF

9.6 CF1830 题解

# 9.6 CF1830 题解 ## A. Copil Copac Draws Trees [链接](https://www.luogu.com.cn/problem/CF1830A) 真弱智题不用讲 ## B. The BOSS Can Count Pairs ### 题意 每组数据给你一个 $n ......
题解 1830 9.6 CF

CF665F

[题目链接](https://codeforces.com/problemset/problem/665/F) ## description 给定 $n\leq 10^{11}$ 求 1 到 $n$ 中恰有 4 个因数的数的个数。 ## solution 这个数据范围容易想到筛子。 题目相当于让求 ......
665F 665 CF

CF1036F

[题目链接](https://codeforces.com/problemset/problem/1036/F) ## description $10^5$ 次询问 每次给定 $n\leq 10^{18}$, 求 2 到 $n$ 内质因子分解结果为 $p_{a_1}^{b_1}p_{a_2}^{b_ ......
1036F 1036 CF

CF1174E

[题目链接](https://codeforces.com/problemset/problem/1174/E) ## description 给定 $n\leq 10^6$, 求有多少个 $1$ 到 $n$ 的排列,对于一个 1 到 $n$ 的排列 $p$,$f(p)$ 表示 $p$ 的任意前缀内 ......
1174E 1174 CF

CF1852C Ina of the Mountain

*2400 https://codeforces.com/problemset/problem/1852/C 如果没有 $\mod k$ 的限制的话,我们都会做,因为都是正数,那么 $\sum_i^n d_i>0$,因此,答案即为 $\sum[d_i>0]d_i$。 但是现在多了一个操作,即为区间加 ......
Mountain 1852C 1852 Ina the

【题解】CF2600DP 选练(23.9.5-23.9.6)

低情商:感觉是比较套路的 高情商:十分 educational!!! ## CF258D Little Elephant and Broken Sorting ### 题目描述: 有一个 $[1,n]$ 的排列 $a$,会进行 $m$ 次操作,操作为交换 $(a_i,a_j)$。每次操作都有 $50 ......
题解 2600 23 CF DP

CF626F Group Projects

发现直接做非常困难,考虑将能力值排序后从小到大插入。 令 $f_{i,j,l}$ 表示前 $i$ 个人,有 $j$ 组需要继续加人,不和谐度之和**恰好**为 $l$ 的方案数。此时加入一个人对不和谐度之和产生的贡献为 $t=j\times(a_{i+1}-a_i)$。分三种情况转移: - 组数加一 ......
Projects Group 626F 626 CF

LCM Sum (CF E ) (正男则反, 二维数点/二维偏序, 大胆的抽象化简数学式子, 打表找规律)

思路: CF1712 E1/E2 LCM Sum (easy/hard version) 二维数点/二维偏序: 二维前缀和+扫描线+树状数组+ 离线处理 应用: 求 Q次询问, L-R内 x-y的 点的数量(矩形内点的数量) 直接用二维前缀和, 时间复杂度, 一定不允许, 发现 二维前缀和是由 4个 ......
偏序 式子 规律 数学 LCM

CF724G Xor-matic Number of the Graph

[题目链接](https://codeforces.com/problemset/problem/724/G) 不妨先看一道更为基础的题:[CF845G](https://codeforces.com/problemset/problem/845/G)以及[它的题解](https://www.cnb ......
Xor-matic Number Graph matic 724G

CF444C DZY Loves Colors

## [$DZY$ $Loves$ $Colors$](https://codeforces.com/problemset/problem/444/C) ### 一、题面翻译 有一个 $n$ 个元素组成的序列,每个元素有两个属性:颜色 $c_i$ 和权值$w_i$。$c_i$ 初始为$i$,$w_i ......
Colors Loves 444C 444 DZY

CF1860D 题解

在 Codeforces 上看到了这题的 $\mathcal{O}(n ^ 4 / \omega)$ 做法,和大家分享一下。 [原版 Solution 链接](https://codeforces.com/blog/entry/119504?#comment-1060285) 记 $d$ 为原字符串 ......
题解 1860D 1860 CF

【题解】CF1852D Miriany and Matchstick

考虑 `dp`,设 $f_{i,0/1}$ 表示考虑到前 $i$ 位,且第 $i$ 位填入 A/B 可能的答案集合,显然地朴素转移时间复杂度 $O(n^2)$。 试分析 `dp` 性质,观察发现所有 `dp` 中得到的集合为区间内抠去至多一个点。 > > 证明 > 我们首先来观察转移过程是怎样的。第 ......
题解 Matchstick Miriany 1852D 1852

【题解】CF1852C Ina of the Mountain

我们先从题目的一部分入手。 如果说,我们没有当一个数为 $0$ 时,让这个数变成 $k$ 的性质,我们如何求答案呢? 很简单,在图上就是: 绿色线段的长度加起来即为答案(本图中是 $6$) 我们考虑很显然地,将一个数从 $0$ 变为 $k$ 即为将一个数一开始加上 $k$ 我们如果要让第 $i$ 列 ......
题解 Mountain 1852C 1852 Ina

It is strongly discouraged to install anything else in the base envionment

For both mamba and conda, the base environment is meant to hold their dependencies. It is strongly discouraged to install anything else in the base en ......

CF1695D2 Tree Queries (Hard Version)

[原题](https://codeforces.com/problemset/problem/1695/D2) [翻译](https://www.luogu.com.cn/problem/CF1695D2) $$ \large{\color{#ff0000}{\text{被xjk搏杀了,wtcl}} ......
Queries Version 1695D 1695 Tree

CF845G Shortest Path Problem?

[原题链接](https://codeforces.com/problemset/problem/845/G) 不妨先了解几个前置知识/引理: 异或的抵消性质: * $a\oplus a=0$ * $\forall b[b\not= a],a\oplus b\not=0$ * $(a\oplus b ......
Shortest Problem 845G Path 845

【题解】CF1852B Imbalanced Arrays

我们假设当前出长度为 $len$,那么我们在序列中一定有一个 $len/0$,因为一定有一个绝对值最大的数,如果这个数是正数在原序列中就是 $len$,是负数在原序列中即为 $0$。 由上文,我们可以得到,一定不能有 $len$ 和 $0$ 同时出现的情况,也一定不能有 $len$ 和 $now$ ......
题解 Imbalanced Arrays 1852B 1852

【题解】Educational Codeforces Round 145(CF1809)

## A.Garland ### 题目描述: 有 $4$ 只灯泡,第 $i$ 只灯泡的颜色为 $s_i$ 。 一开始,所有灯泡都是关着的,你需要把它们都打开。你可以进行数次操作,每次操作改变一个灯泡的状态,即打开原本关着的灯泡或关上原本亮着的灯泡。第一次操作可选择任何灯泡,此后每一次被操作的灯泡的颜 ......
题解 Educational Codeforces Round 1809

[CF1768F]Wonderful Jump

[Wonderful Jump](https://www.luogu.com.cn/problem/CF1768F) 题目看错了,以为能往回跳...... 暴力转移式 $$ dp_i=min(dp_i,dp_j+\min_{k=j}^ia_k\times(i-j)^2) $$ 你会发现这个没啥单调性 ......
Wonderful 1768F 1768 Jump CF

CF1854 题解

# CF1854 题解 ### A 首先考虑只有非负的情况,次数完全可以接受 $19$ 次,所以直接用 $19$ 次做一次前缀和就可以保证单调不降了。 现在有了负数,考虑将负数变成正数,选出正数当中的最大值,然后用 $a_i + a_i \to a_i$ 这样自增的方式让它的绝对值大于负数最大值,因 ......
题解 1854 CF

CF1852 题解

# CF1852 题解 ## A Ntarsis' Set ### 题意 有一个集合,初始状态里面有数字 $1$、$2$、$3$、$4$、$5$、......、$10^{1000}$。 现在给你一个长度为 $n$ 数组 $a (1\leq a_i \leq 10^9 )$,要进行 $k$ 次操作,每 ......
题解 1852 CF

【题解】CF1852A Ntarsis' Set

考虑我们先手模一下样例: $$ \begin{cases} 1&3&5&6&7\\ 2&8&10&11&12\\ 4&13&15&16&17 \end{cases} $$ ???一脸疑惑,有什么规律吗?真有,但是很难看出来捏。 正难则反,我们考虑如果知道操作一次后一个数的位置,我们可以很容易推出,操 ......
题解 Ntarsis 1852A 1852 Set

[CF1641D] Two Arrays

## 题目描述 Sam changed his school and on the first biology lesson he got a very interesting task about genes. You are given $ n $ arrays, the $ i $ -th o ......
Arrays 1641D 1641 Two CF

[CF1830E] Bully Sort

## 题目描述 On a permutation $ p $ of length $ n $ , we define a bully swap as follows: - Let $ i $ be the index of the largest element $ p_i $ such that ......
1830E Bully 1830 Sort CF

[CF1599A] Weights

## 题目描述 You are given an array $ A $ of length $ N $ weights of masses $ A_1 $ , $ A_2 $ ... $ A_N $ . No two weights have the same mass. You can put ......
Weights 1599A 1599 CF

[CF1830D] Mex Tree

## 题目描述 You are given a tree with $ n $ nodes. For each node, you either color it in $ 0 $ or $ 1 $ . The value of a path $ (u,v) $ is equal to the ME ......
1830D 1830 Tree Mex CF

[CF1854C] Expected Destruction

## 题目描述 You have a set $ S $ of $ n $ distinct integers between $ 1 $ and $ m $ . Each second you do the following steps: 1. Pick an element $ x $ in ......
Destruction Expected 1854C 1854 CF