codeforces country binary ralph

Codeforces Round 884 (Div. 1 + Div. 2) A-E

# Codeforces Round 884 (Div. 1 + Div. 2) 题目链接:[Codeforces Round 884 (Div. 1 + Div. 2)](https://codeforces.com/contest/1844 "Codeforces Round 884 (Div. ......
Codeforces Div Round 884 A-E

Codeforces 1495E - Qingshan and Daniel

假设 $1$ 号队伍机器人总牌数比 $2$ 号队伍多,那么显然最终 $2$ 号队伍中的牌都会走光。 如果 $1$ 号机器人属于 $1$ 号队伍那么我们暴力模拟第一轮即可。下面只讨论 $1$ 号机器人属于 $2$ 号队伍的情况。 由于我们走牌顺序一定是 $212121212\cdots 21$ 直到没 ......
Codeforces Qingshan Daniel 1495E 1495

Codeforces 1396E - Distance Matching

先考虑一下合法的 $k$ 的上界和下界是什么以及如何达到上界和下界,我们找出树的一个重心 $R$ 并以 $R$ 为根 dfs 一遍整棵树,那么: - 下界为 $\sum(siz_i\bmod 2)$,构造方法是从下往上钦定,对于一个点考虑其所有没有匹配的儿子,如果是偶数个就将它们两两匹配,如果是奇数 ......
Codeforces Distance Matching 1396E 1396

Codeforces 1740H - MEX Tree Manipulation

首先发现一个性质,那就是每个点的点权是 $\log n$ 级别的。因为假设要造出一个点权为 $i$ 的点至少需要大小为 $mn_i$ 的子树,那么显然有 $mn_i=\sum\limits_{j=0}^{i-1}mn_j+1$,即 $mn_i=2^i$。 由于点权不是很大,因此我们很容易地往变换复合 ......
Manipulation Codeforces 1740H 1740 Tree

Codeforces Round 884 (Div. 1 + Div. 2) A~D

# Codeforces Round 884 (Div. 1 + Div. 2) 比赛链接:[Codeforces Round 884 (Div. 1 + Div. 2)](https://codeforces.com/contest/1844) ## A. Subtraction Game 题目链 ......
Codeforces Div Round 884

Codeforces Round #882 (Div. 2) A-D

[比赛链接](https://codeforces.com/contest/1847) # A ## 代码 ```c++ #include using namespace std; using ll = long long; int a[107]; int f[107]; bool solve() ......
Codeforces Round 882 A-D Div

codeforces1283F

题目链接 sol:根一定是第一个, 然后不太会,去看了洛谷题解 题解 #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; #define fi first #de ......
codeforces 1283F 1283

Educational Codeforces Round 151 (Rated for Div. 2)

[D. Rating System](https://codeforces.com/problemset/problem/1845/D) **题目大意** 玩家的初始积分为0,该玩家连续进行$n$场比赛,每场比赛可升高或降低玩家的积分($a_i$)。你可以设置一个$k$值,比赛过程中玩家的积分不会低 ......
Educational Codeforces Round Rated 151

codeforces1311E

题目链接 sol:先建一条链,然后把下面的点一个个往上面移, 优先移到最上面,如果上面满了就往下一层, 知道刚刚好凑满距离,如果最后不能移了就说明不能凑出给定的距离 #include <bits/stdc++.h> using namespace std; typedef long long ll; ......
codeforces 1311E 1311

Educational Codeforces Round 28

# A. Curriculum Vitae 因为`1`之后不能出现`0`,所以求一下前缀`0`的个数和后缀`1`的个数,然后枚举第一个`1`的位置即可 ```cpp #include using namespace std; #define int long long int32_t main() ......
Educational Codeforces Round 28

Codeforces Round 884 (Div. 1 + Div. 2)

# Preface 究极坐牢场,比赛降智导致签到签挂,本来秒出的D写错一个极其傻逼的地方浪费半小时 然后后面两个小时坐牢想E和F1,但可惜并没有看出E的性质,被狠狠地薄纱 虽然说实话后面有点困了,但应该不至于写不出这个E的,只能说最近的状态真是堪忧啊 # A. Subtraction Game 首先 ......
Codeforces Div Round 884

Codeforces Round 884 (Div. 1 + Div. 2)

# A. Subtraction Game 答案就是`a+b`此时后手必胜因为无论怎么操作后手都可保证自己取的时候一次全部取完 ```cpp #include using namespace std; void solve(){ int a , b; cin >> a >> b; cout > t; ......
Codeforces Div Round 884

Codeforces Round 884 (Div. 1 + Div. 2) 题解A~D

我想想啊,这一场我才从发烧中爬起来打,勉勉强强做了一题,然后后面的全是构造,最后无奈下班。 脑袋有些晕,复杂一点的代码都不想写,实在是太痛苦了。 这一场掉74分。可能确实是不太行了,越打越菜。 A题 很简单一道题,样例里也给了解法,只要有a+b个,就可以保证后手赢。 B题 是构造,打表了,当时觉得万 ......
题解 Codeforces Div Round 884

codeforces-817 D. Imbalanced Array(单调栈)

![image](https://img2023.cnblogs.com/blog/3070624/202307/3070624-20230712121051112-1667145400.png) 题意:求数组中每个连续子序列的的最大值-最小值之和。 思路:题意可以理解为加上每一个序列的最大值,减去 ......
codeforces Imbalanced Array 817

Codeforces Round 884 (Div. 1 + Div. 2) D. Row Major

题目要求输出一个字符串,使用最少的字符种类,使得任意所有的i行j列中任意相邻的字符不同 首先相邻的肯定必须不同,i-1和i一定不同,其次观察可得,1和2不同,如果n%3==0的话,则1和2和3都不同,如此反复,直到n%i!=0,则i可以取和1相同然后,得到连续的最长长度为1~i #include < ......
Codeforces Div Round Major 884

Codeforces Round 884 (Div. 1 + Div. 2) C. Particles

思路:DP f[i]表示的是i可以到达的最大值 从左往右遍历,对于i来说最大值有三种情况 1:i本身就是最大 2:去掉i-1,i和i-2合并,这里的i-2是指和前面合并完达到最大的值 3:i前面某一个数字j最大,其中j~i之间恰好为奇数个,可以合并抵消掉,例如100 -1 -4 -1 100 #in ......
Codeforces Div Particles Round 884

Codeforces Round 884 (Div. 1 + Div. 2) B. Permutations & Primes

题目大意求出一个n的排列,使得对于所有的长度的子区间其中不包含在该子区间中最小正整数为质数,这样的区间数最多 对于任意长度的区间,如果1不包含,则这样的区间一定是bad的,因此我们想要1尽可能在区间中则1放中间,此外,2和3是除1外的最小正整数也是质数,如果2和3不包含在区间则该区间一定是good的 ......
Permutations Codeforces Div Primes Round

Codeforces Round 871 (Div. 4) ABCDEF

> 很久没写题目了,划点水题 ###A. Love Story ``` #include using namespace std; typedef long long LL; typedef pair PII; const LL MAXN = 1e18; const LL N = 1e6, M = ......
Codeforces ABCDEF Round 871 Div

「解题报告」Codeforces Round #884 (Div. 1 + Div. 2) Editorial

比赛地址:[Dashboard - Codeforces Round 884 (Div. 1 + Div. 2) - Codeforces](https://codeforces.com/contest/1844) 个人评价:这场是**构造**专场! ## A. Subtraction Game [ ......
Codeforces Div Editorial 报告 Round

CodeForces Gym 102900B Mine Sweeper II

[CF 传送门](https://codeforces.com/gym/102900/problem/B "CF 传送门") 感觉像脑筋急转弯。 考虑所有数字之和就是相邻的 $(\text{雷}, \text{空地})$ 对数,因此翻转后这个对数不会改变。 然后由于抽屉原理,$b \to a$ 和 ......
CodeForces 102900B Sweeper 102900 Mine

CodeForces 1364D Ehab's Last Corollary

[洛谷传送门](https://www.luogu.com.cn/problem/CF1364D "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1364/D "CF 传送门") 简单题。 特判掉 $m = n - 1$ 的情况 ......
CodeForces Corollary 1364D 1364 Ehab

CF1360H Binary Median 题解

提供一份好看的题解。 $2^m-n$ 个数的中位数排名是 $\lfloor\dfrac{2^m-n-1}2\rfloor$(从 $0$ 开始)。因为所有元素是连续的,只要数出被删掉的比中位数小的元素数量,那么 $\lfloor\dfrac{2^m-n-1}2\rfloor$ 加上数量就是中位数了。 ......
题解 Binary Median 1360H 1360

Codeforces Round #771 (Div. 2) A-E

# A ## 代码 ```c++ #include using namespace std; using ll = long long; int p[507]; bool solve() { int n; cin >> n; for (int i = 1;i > p[i]; int pos1 = 0 ......
Codeforces Round 771 A-E Div

CodeForces 1525F Goblins And Gnomes

[洛谷传送门](https://www.luogu.com.cn/problem/CF1525F "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1525/F "CF 传送门") 套路地,将 DAG 的最小不交路径覆盖转化为点数 ......
CodeForces Goblins Gnomes 1525F 1525

D. Bag of mice -- (概率Dp)codeforces 148

###原题链接:[https://codeforces.com/contest/148/submission/213227373](https://codeforces.com/contest/148/submission/213227373) ###题意:捉老鼠游戏,谁捉到白鼠就是胜利,我们求公主 ......
概率 codeforces mice Bag 148

E. Two Chess Pieces -- (codeforces) 树形DP

###原题链接:[https://codeforces.com/contest/1774/problem/E](https://codeforces.com/contest/1774/problem/E) ###题意:两颗棋子,给出两颗棋子必须要去的顶点,且给出两颗棋子的相隔距离不能大于d,算出两颗 ......
树形 codeforces Pieces Chess Two

Educational Codeforces Round 23

# A. Treasure Hunt ```cpp #include using namespace std; int read() { int x = 0, f = 1, ch = getchar(); while ((ch '9') && ch != '-') ch = getchar(); i ......
Educational Codeforces Round 23

Sum in Binary Tree

Sum in Binary Tree time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vanya really likes mat ......
Binary Tree Sum in

Codeforces Round 883 (Div. 3)

# Codeforces Round 883 (Div. 3) 题目链接:[Codeforces Round 883 (Div. 3)](https://codeforces.com/contest/1846 "Codeforces Round 883 (Div. 3)") ## A. Rudolp ......
Codeforces Round 883 Div

Educational Codeforces Round 96 (Rated for Div. 2)E

You are given a string s. You have to reverse it — that is, the first letter should become equal to the last letter before the reversal, the second le ......
Educational Codeforces Round Rated Div