codeforces round 872 a-d

Codeforces Round 874 (Div. 3) B. Restore the Weather

给一个长为 $n$ 的数组 $a$ ,给一个长为 $n$ 的乱序数组 $b$ ,给一个正整数 $k$ 。要求重排 $b$ 使得 $\forall i, |a_i - b_i| \leq k$ 。输出其中一种 $b$ 的排列方式。 一个性质题。(div2 前几题很喜欢有序数组的经典性质) 总结一下有序 ......
Codeforces Restore Weather Round 874

Codeforces Round 868 (Div. 2) B. Sort with Step

给一个长为 $n$ 的排列(无序)$p$,为 $p_1, p_2, \cdots, p_n$ 。一个正整数 $k$ 。 允许执行任意次以下操作: * 选择两个数 $p_i$ $p_j$ 满足 $|i - j| = k$ ,并且 $swap(p_i, p_j)$ 。 允许最多执行一次特殊操作: * 选 ......
Codeforces Round Sort with Step

Codeforces Round 845 (Div. 2) and ByteRace 2023 B. Emordnilap

给一个长为 $n$ 的排列,对于它的每一个排列 $p$ ,复制一份并 $reverse$ 拼到原排列的后面得到 $a = \left [p, p_{reverse} \right ]$ 。 求 $p$ 的所有排列对应的 $a$ 的逆序对数之和,结果对 $1E9+7$ 取模。 **逆序对贡献**: * ......
Codeforces Emordnilap ByteRace Round 2023

* Codeforces Round 885 (Div. 2) A. Vika and Her Friends

给一个 $n \times m$ 的网格,每个格子对应一个坐标 $(a, b)$ 。如果存在一个各自的坐标为 $(c, d)$ 且满足 $|a - c| + |b - d| = 1$ ,则称 $(a, b)$ 与 $(c, d)$ 相邻。 给出 $k + 1$ 个点,初始坐标分别为 $(x_0, y ......
Codeforces Friends Round Vika 885

Educational Codeforces Round 151 (Rated for Div. 2) B. Come Together

给三个点 $A, B, C$ ,两个人一开始都在 $A$ 点,一个人希望最快到达 $B$ ,另一个人希望最快到达 $C$ ,且他们希望尽可能走一条路径。则这条路径最长是多长。 经典的高维可以由低维叠加的问题。 * 坐标问题 * 动态规划问题 并非所有高维问题都可由低维叠加,但任何二维问题都可由一维叠 ......
Educational Codeforces Together Round Rated

Educational Codeforces Round 149 (Rated for Div. 2) B. Comparison String

给一个长度为 $n$ 的字符串 $s$ ,只包含字符“”。 一个长度为 $n + 1$ 的数组 $a$ 与 $s$ 是兼容的当且仅当对于任意 $i$ : 1. $s_i$ is $$ ,当且仅当 $a_i > a_{i - 1}$ 定义一个数组的 $cost$ 为这个数组中不同数的个数。 求一个 $ ......

Educational Codeforces Round 143 (Rated for Div. 2) B. Ideal Point

给 $n$ 条一维线段,一条端点为 $l, r$ 的线段可以覆盖 $\forall i, l \leq i \leq r$ 。定义 $f(x)$ 为点 $x$ 被线段覆盖的次数。一个点 $x$ 称为是 “完美的” 如果 $y \neq x, f(x) > f(y)$ 。 给一个点 $k$ ,询问是否 ......
Educational Codeforces Round Rated Ideal

* Codeforces Round 890 (Div. 2) supported by Constructor Institute B. Good Arrays

————哪有岁月安好,只是有人为你负重前行 给一个长为 $n$ 的数组 $a$ ,称一个数组 $b$ 是 $good$ 的如果满足以下条件: 1. $\forall i, a_i \neq b_i$ 2. $\sum_{i=1}^{n}a_i=\sum_{i=1}^{n}b_i$ 判断对于一个 $a ......

* Codeforces Round 886 (Div. 4) D. Balanced Round

有 $n$ 个值,分别为 $a_1, a_2, \cdots, a_n$ 。希望做两个操作 1. 移除一些(可能是 $0$ 个)问题 2. 重排列剩下的问题 一组值是好的当且仅当任意对于 $\forall i, j,\ 1 \leq i,j \leq n,\ |i - j| = 1,\ s.t.\ ......
Round Codeforces Balanced 886 Div

codeforce800

题目链接 [https://vjudge.csgrandeur.cn/contest/578660](https://vjudge.csgrandeur.cn/contest/578660#overview) 题解 [toc] ## A CodeForces 1859A United We Stan ......
codeforce 800

【题解】Educational Codeforces Round 145(CF1809)

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

Educational Codeforces Round 154 (Rated for Div. 2)

# Educational Codeforces Round 154 (Rated for Div. 2) [比赛链接](https://codeforces.com/contest/1861) 我都快忘了还有这一场比赛,今天打开cf看见这场比赛正好有时间就补了!!! 2023.9.3也许是出去玩了 ......
Educational Codeforces Round Rated 154

现代 CSS 解决方案:数学函数 Round

在 CSS 中,存在许多数学函数,这些函数能够通过简单的计算操作来生成某些属性值,例如在[现代 CSS 解决方案:CSS 数学函数](https://github.com/chokcoco/iCSS/issues/177)一文中,我们详细介绍了 + calc():用于计算任意长度、百分比或数值型数据 ......
函数 解决方案 数学 方案 Round

Educational Codeforces Round 7 A - E

# [Educational Codeforces Round 7](https://codeforces.com/contest/622) [TOC] ## [A - Infinite Sequence](https://codeforces.com/contest/622/problem/A) ......
Educational Codeforces Round

【牛客周赛 Round 10】A-D题解

### A https://ac.nowcoder.com/acm/contest/64272/A **题意** 游游定义一个数组为“稳定的”,当且仅当数组相邻的两个元素之差的绝对值不超过1。例如[2,3,2,2,1]是稳定的,而[1,3,2]则不是稳定的。 游游拿到了一个数组,她想求出该数组的最长 ......
题解 Round A-D

【题解】AtCoder Regular Contest 163 A-D

E 太过于 adhoc,F 太过于神仙,就不做了。 ## A.Divide String ### 题目描述: 多组数据。 给出一个长为 $N$ 的字符串,问能否将其划分为多段,使字典序**严格**上升,保证 **$\sum{N}\le2000$**。 $ 2\ \le\ N\ \le\ 2000 $ ......
题解 AtCoder Regular Contest 163

Pinely Round 2 (Div. 1 + Div. 2)

Channel 简单分类讨论情况即可 算下最多有多少人在线即可 void solve(){ int n , a , q ; cin >> n >> a >>q ; int add = 0 , minn = 0 , maxx = 0 ; cin >>in +1 ; for(int i = 1 ; i ......
Div Pinely Round

Educational Codeforces Round 6 A - E

# [Educational Codeforces Round 6](https://codeforces.com/contest/620) [TOC] ## [A - Professor GukiZ's Robot](https://codeforces.com/contest/620/probl ......
Educational Codeforces Round

Educational Codeforces Round 154 (Rated for Div. 2)

# Preface 太FW了现在,纯纯给队伍拖后腿,马上要成为我们队CF Rating最低的了 但换句话说徐神和祁神都这么猛,我直接躺着被嘎嘎带飞好像也很爽啊 不管怎么样还是要多练,不过接下来可能要按专题重点突破了,明天队里开个会确定下大家的主攻方向再说 # A. Prime Deletion 因为 ......
Educational Codeforces Round Rated 154

Pinely Round 2 (Div. 1 + Div. 2)

# Preface 唉懒狗了这把比赛的时候突然不想打了跑去看AIR了,所以就没打了,后面补题的时候发现前面题挺合我口味的如果打了大概率能上橙 不过这种第二天早上有早八的时间还是很难打的,苦路西苦路西 # A. Channel 统计当存在某个时刻在线人数为$n$时就是```YES``` 否则把所有的` ......
Div Pinely Round

Educational Codeforces Round 23 A - F

# [Educational Codeforces Round 23](https://codeforces.com/contest/817) [TOC] ## [A - Treasure Hunt](https://codeforces.com/contest/817/problem/A) 往四个 ......
Educational Codeforces Round 23

Educational Codeforces Round 154 (Rated for Div. 2)(A—C)

# [A. Prime Deletion](http://codeforces.com/contest/1861/problem/A "A. Prime Deletion") ## 思路: 从1到9,每个数后面都可以加一个数构成一个含有两个数的质数,只需要从s[1]~s[9]中找到一个数与s[0]构 ......
Educational Codeforces Round Rated 154

【题解】Educational Codeforces Round 153(CF1860)

每次打都想感叹一句,Educational 名不虚传。 ## A.Not a Substring ### 题目描述: 有 $t$ 组数据,对于每一组数据,你需要判断能否构造一个只由左右括号组成且长度为已经给定字符串的 $2$ 倍且已经给定的字符串不是子串的合法字符串。注:合法的字符串是左右括号能完全 ......
题解 Educational Codeforces Round 1860

Educational Codeforces Round 113

稳定发挥4题 A题文件输出没去掉WA了一发 B题特殊情况没判到,WA了好几发,中间还交到D题去了 C题简单判断一下无解,然后组合数求一下就行 D题其实也挺简单的,考虑严格夹在两条竖线之间的点(不包括边界),如果它们不是在同一水平线上,则必然大于Manhattan距离,而且两个点对之间要么是x方向走多 ......
Educational Codeforces Round 113

Educational Codeforces Round 154 (Rated for Div. 2)

感觉edu的题目都比较有新意; A.Prime Deletion 题意:给定长度为9的数,且1-9每个数字出现一次,求按照原定顺序选几个数组成的质数(起码选择两个); 下意识写了一个dfs,过了; 1 #include<bits/stdc++.h> 2 using namespace std; 3 ......
Educational Codeforces Round Rated 154

Educational Codeforces Round 123

# A. Doors and Keys ```cpp #include using namespace std; #define int long long void solve() { string s; cin >> s; map pos; for( int i = 0 ; i > t; whi ......
Educational Codeforces Round 123

Educational Codeforces Round 15 A - E

# [Educational Codeforces Round 15](https://codeforces.com/contest/702) [TOC] ## [A - Maximum Increase](https://codeforces.com/contest/702/problem/A) ......
Educational Codeforces Round 15

Educational Codeforces Round 5 A-E

# [Educational Codeforces Round 5](https://codeforces.com/contest/616) ![image-20230901173739735](C:\Users\magicat\AppData\Roaming\Typora\typora-user- ......
Educational Codeforces Round A-E

Educational Codeforces Round 114

今天的D题有点惊险了,属于是,还剩9分钟搞出来。 B题开始猜到了结论,只要在最大值和最小值之间都是可以的,证明的话,可以先考虑从数量大的开始填,然后反证法一下(口胡) C题选择attack肯定是尽量跟,dragon的defence越接近越好 如果有相等就直接选,否则就选前面的或者后面的 本来写的是b ......
Educational Codeforces Round 114

Codeforces Round 894 (Div. 3)

## $A. Gift Carpet$ ```cpp void solve(){ int n=read(),m=read(); char a[n+1][m+1]; for(int i=1;i>a[i][j]; } } string s="vika"; int cnt=0; for(int i=1;i ......
Codeforces Round 894 Div