codeforces sorting round 1839

* Codeforces Round 889 (Div. 2) B. Longest Divisors Interval

给一个正整数 $n$ ,找一段最长的 $[l, r]$ ,满足 $\forall i, i \in [l, r],\ s.t.\ i | n$ 。输出这一段区间的长度,即 $r - l + 1$ 。 这题是一个准结论题,需要一些知识点和观察的基础。 放在 $900$ 的位置是因为结论存在的区间太容易 ......
Codeforces Divisors Interval Longest Round

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 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

ES中reverse_nested+sum+bucket_sort

`{ "aggregations": { "agg_entity_a": { "aggregations": { "filter_product_agg": { "aggregations": { "agg_entity_b": { "aggregations": { "reverse_nested ......

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

Sort a N sorted array

Given an array of n elements, where each element is at most k away from its target position, you need to sort the array optimally. Example 1: Input: n ......
sorted array Sort

python内置函数 - map, reduce, filter, sort

1, map(fn, 可迭代对象) 参数fn为一个参数的函数 lambda方式 my_list = [2, 3, 4, 5] result = map(lambda x: x * x, my_list) # 返回元素平方值的迭代器 print(type(result)) # <class 'map' ......
函数 python filter reduce sort

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

[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

CF1861C Sorting By Multiplication

## 思路 机翻害人,我还以为是 $1$ 和 $0$ 是对原序列排序,害得我比赛的时候都没对,恼。 首先,对于新加入的数字,我们可以先不确定是否有序,而是等到后续的 $1$ 或 $0$ 出现,再确定。 用 $num$ 表示目前有多少数字,用 $so$ 表示确定有序的数字中最后一位的位置,$nso$ ......
Multiplication Sorting 1861C 1861 CF

CF1861D Sorting By Multiplication

## 思路 先考虑不能把数变为负数的情况。 显然,当 $a_i\ge a_{i+1}$ 时,需要对 $[i+1,n]$ 的数都要乘以一个很大的数。 所以答案是 $a_i\ge a_{i+1}$ 的个数。 但是可以变为负数,考虑把一部分变为递减的,再变成负数,另一部分正常计算。 因为负数一定小于正数, ......
Multiplication Sorting 1861D 1861 CF

现代 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

AGC057E RowCol/ColRow Sort【性质,DP】

给定一个 $n \times m$,值域 $[0,9]$ 的矩阵 $B$,计数有多少个大小相同的矩阵 $A$ 满足下列条件: - 分别对 $A$ 的每一列中元素从小到大排序,再分别对 $A$ 的每一行中元素从小到大排序能够得到 $B$。 - 分别对 $A$ 的每一行中元素从小到大排序,再分别对 $A ......
性质 RowCol ColRow 057E Sort

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

D. Sorting By Multiplication

D. Sorting By Multiplication You are given an array $a$ of length $n$, consisting of positive integers. You can perform the following operation on thi ......
Multiplication Sorting By

【题解】Educational Codeforces Round 153(CF1860)

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