codeforces library 1776c game

deal.II — an open source finite element library

简介: What it is: A C++ software library supporting the creation of finite element codes and an open community of users and developers. (Learn more.) Mi ......
element library finite source deal

Codeforces Round 877 (Div. 2)

# Preface 补题 这场补题的时候直接成腐乳了,A题挂两发,B题挂两发,C题挂一发是真的抽象 虽然D是个套路题看一眼就秒了,但如果真的比赛时候打真要罚时爆炸了的说 后面的EF还是做不来啊岂可修,不过都很有启发性让人感觉神清气爽,不像傻逼蓝桥杯花钱买罪受 # A. Blackboard List ......
Codeforces Round 877 Div

Codeforces Round 876 Div2 A-D题解

# Codeforces Round 876 Div2 A-D题解 # A.The Good Array 这个题就是问你对于 $i \leq n$,要求前面后面至少 $ceil(\frac{i}{k})$ 个 1 那我们就贪心的每k个放一个1,或者直接用数学算一下就好了 AC 代码 ```cpp # ......
题解 Codeforces Round Div2 876

[Codeforces Round 876 (Div. 2)][Codeforces 1839D. Ball Sorting]

题目链接:[D - Ball Sorting](https://codeforces.com/contest/1839/problem/D) 题目大意:需要对一个排列按照指定操作进行排序。操作一:在数字间插入一个特殊点,可执行不超过 $k$ 次;操作二:将在特殊点旁的数移动到任意位置。所有操作结束后 ......
Codeforces Sorting Round 1839 Ball

Codeforces 1188D Make Equal

设最终所有数变为的值为 $u$,$\operatorname{bitcount}(x)$ 为 $x$ 二进制上为 $1$ 的位数,由题可得答案即为 $\sum\limits_{i = 1}^n \operatorname{bitcount}(u - a_i)$。 此时让 $a_i$ 从小到大排序,答 ......
Codeforces 1188D Equal 1188 Make

【每日一题】Problem 327A - Flipping Game

[原题](https://codeforces.com/problemset/problem/327/A) #### 解决思路 计算数字 "1" 的最大数目,可以转换成计算数组最大和,即求 $maxSum(oldArraySum - (1 \rightarrow 0) + (0 \rightarro ......
Flipping Problem 327A Game 327

Codeforces 1626 C

# [1626 C](https://codeforces.com/problemset/problem/1626/C) ## 题意 抽象出题意:给出n个区间的结尾以及它的区间长度,然后每一段连续区间的贡献为$\sum_{i=1}^{len} i$ ,求总贡献。 ## 思路 处理出每个区间的开头结尾 ......
Codeforces 1626

[ABC166F] Three Variables Game

[Three Variables Game の 传送门](https://www.luogu.com.cn/problem/AT_abc166_f) ## Solution 首先,我们每次操作只会修改两个数。 所以考虑 dfs 枚举操作的顺序,但是这让时间复杂度变为 $O(2^n)$,不能接受。 但 ......
Variables Three 166F Game ABC

CodeForces 1840G In Search of Truth

[洛谷传送门](https://www.luogu.com.cn/problem/CF1840G2 "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1840/G2 "CF 传送门") 每次询问获得的信息只有当前所在位置的数字。考 ......
CodeForces Search 1840G Truth 1840

Codeforces 1514 C

# [1514 C](https://codeforces.com/problemset/problem/1514/C) ## 题意 给出一个数n,求[1,2,3...n-1]的某个最长子序列,这个子序列的元素乘积模n余1。 ## 思路 这是个思维题,一个数学公式 $$x \equiv 1(mod  ......
Codeforces 1514

Codeforces 1515 B

# [1515 B](https://codeforces.com/contest/1515/problem/D) ## 题意 有n只袜子(n为偶数),但左袜子有L只,右袜子有R只,每只袜子的颜色为$C_i$,可以进行以下操作:换袜子的方向、或者将袜子变色,问进行多少次操作后变成(n/2)对袜子 # ......
Codeforces 1515

error while loading shared libraries: libreadline.so.5: cannot open shared object file:

错误信息: ftp: error while loading shared libraries: libreadline.so.5: cannot open shared object file: No such file or directory 解决办法: yum install -y read ......
shared libreadline libraries loading cannot

Codeforces Round 878 (Div. 3) 题解 A - G2

## 吐槽在前面 太菜了赛后6min过掉的G1,本来以为是因为G1没出没上蓝,结果System Test直接给我C题卡掉了,一看发现我数组开小了一倍,最后险些掉分。 总之就是状况频出的滑铁卢战役qwq。 ## [A](https://codeforces.com/contest/1840/probl ......
题解 Codeforces Round 878 Div

Codeforces Round 876 (Div. 2) 题解 A - D

## [A](https://codeforces.com/contest/1839/problem/A). The Good Array ### 题目大意 给定两个整数 $n$ 和 $k$,规定一个$01$数列为好的的条件是,对于$1\sim n$中任意的 $i$,都有: - $a$ 的前 $i$ ......
题解 Codeforces Round 876 Div

codeforces.com/contest/1553/problem/B

# [简单字符串哈希](https://codeforces.com/contest/1553/problem/B) ## 题意 给一个字符串s和t,问从s的某个位置开始,向右到某个点后再向左,顺序遍历到的字符形成的字符串可否为t。 ## 思路 数据只有500,$O(n^3)$可过,枚举转折点,然后 ......
codeforces contest problem 1553 com

Codeforces Round 876 (Div. 2) A-D

[比赛地址](https://codeforces.com/contest/1839/my) ## A.The Good Array 题意:定义一个数组是good的要求有: 从左往右所有的i,前i个数中至少有[i/k]个数是1 从右往左所有的i,前i个数中至少有[i/k]个数是1 问good数组对于 ......
Codeforces Round 876 A-D Div

codeforces 1200-1400板刷

2023.6.6 C. Scoring Subsequences(二分)(1300) C. Where is the Pizza?(并查集判断环)(1400) D. Vertical Paths (dfs,写法上对于处理叶子节点可以优化)(1300) ......
板刷 codeforces 1200 1400

Codeforces 1566G - Four Vertices(线段树分治)

交了整整 2 页,本来想用随机化卡过去的,后来发现我的实现跑得太慢就写正常做法了。 首先发现最优答案对应的四个点只可能有以下两种可能: - $a,b$ 间有边,$c,d$ 间有边,此时答案是 $a,b$ 边权值加 $c,d$ 边权值。 - $a$ 与 $b,c,d$ 三个点间都有边,此时答案是三条边 ......
线段 Codeforces Vertices 1566G 1566

Codeforces 1801D The way home

看到 `shortest paths` 来做的。 首先有一个贪心的策略,对于当前点 $u$ 若不能直接往后走则肯定是选择经过的点中 $w_i$ 最大的加。 很好理解,证明就不需要了。 所以可以定义状态 $f_{u, mx}$ 为 $u$ 点最大能加的值为 $h_{mx}$ 的最优状态,$h$ 是 $ ......
Codeforces 1801D 1801 home The

Codeforces 1588F - Jumping Through the Array

显然无法用 polylog 的数据结构维护,序列分块也不行,考虑询问分块。每 $B$ 个询问处理一次。 将这个询问中 $2,3$ 操作涉及到的点设为“关键点”,那么容易发现,环上每一段以关键点结尾的链在这块操作的过程中始终保持不变,也就是说我们可以把它们缩在一起。 先预处理出每个块的增量对每组询问的 ......
Codeforces Jumping Through 1588F Array

Codeforces 1495F - Squares

不知道怎么放到 div1F 的,感觉没啥亮点。 首先对于一条 $1$ 到 $n+1$ 的路径而言,它经过的点的编号一定是递增的,也就是说,如果我们将关键点大小排个序,那么答案就是相邻两点间最短路的和。删 / 加点造成的变化是 $O(1)$ 的,所以问题等价于,多次询问这张图中 $x,y$ 之间最短路 ......
Codeforces Squares 1495F 1495

Codeforces 1299E - So Mean

先考虑一个平方的做法。我们先问出 $1,n$:遍历所有元素,删掉它以后问一下剩余 $n-1$ 个元素形成的集合,如果是 $n-1$ 的倍数说明这个元素要么 $1$ 要么 $n$,由于两个排列是镜像的所以任意钦定一个是 $1$ 一个是 $n$ 即可。删掉两个元素以后归纳问剩余部分也可以知道 $2,n- ......
Codeforces 1299E 1299 Mean So

CodeForces 1838E Count Supersequences

[洛谷传送门](https://www.luogu.com.cn/problem/CF1838E "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1838/E "CF 传送门") **结论:$a_i$ 对答案没有影响。** 考虑 ......
Supersequences CodeForces 1838E Count 1838

Codeforces 1737G - Ela Takes Dancing Class(平衡树)

数据结构好题。 先考虑如果 $s_i$ 全是 $1$ 怎么做。考虑一个非常特殊的状态:如果当前最靠左的舞蹈者跳一步就能跳到最靠右的舞蹈者的右边,那么这样的局面性质其实是非常完美的。因为容易归纳证明,这样的局面下,每一步最靠左的舞蹈者跳一步都能跳到最靠右的舞蹈者的右边,这样一来,如果维护出了初始局面下 ......
Codeforces Dancing 1737G Class Takes

[ABC201D] Game in Momotetsu World 题解

[Game in Momotetsu World](https://www.luogu.com.cn/problem/AT_abc201_d) ### 题目大意 在一个 $n\times m$ 的网格中,存在红色和蓝色两种格子,红色格子用 `-` 表示,蓝色格子用 `+` 表示。 现在 Takaha ......
题解 Momotetsu World 201D Game

AtCoder Beginner Contest 258 G Grid Card Game

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc259_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc259/tasks/abc259_g "AtCoder 传送门") 记 $b_i = ......
Beginner AtCoder Contest Card Grid

Codeforces Round 876 (Div. 2)

# Preface DP腐乳闪总出列! (本来以为大掉分的一把,但这个号因为挺新的所以竟然还能上挺多分的,压线完成了5场上紫) 早知道去做E题了,感觉CF真得要看题目相性,有些题目就是一眼感觉不适合自己的说 # A. The Good Array 一个要动点脑子的签到题,因为$a_1,a_n$必须等 ......
Codeforces Round 876 Div

Codeforces Round 876 (Div. 2)题解

# [Codeforces Round 876 (Div. 2)](https://codeforc.es/contest/1839 "Codeforces Round 876 (Div. 2)") ## [A. The Good Array](https://codeforc.es/contest ......
题解 Codeforces Round 876 Div

2023.5 codeforces 杂题选做

## 2023.5 codeforces 杂题选做 #### [E. Location](https://codeforces.com/contest/1732/problem/E) $n\le 5\times 10^4$ 的范围,并且区间赋值、区间维护最值,可以考虑分块。然后对于散块的修改可以直接 ......
codeforces 2023.5 2023

[LeetCode] 1345. Jump Game IV 跳跃游戏之四

Given an array of integers `arr`, you are initially positioned at the first index of the array. In one step you can jump from index `i` to index: - `i ......
LeetCode 1345 Jump Game IV