codeforces triangle tenzing 1842e

「题解」Codeforces 825G Tree Queries

点权转边权,把边权设为两个端点的 $\min$,然后发现询问 $x$ 的答案,就是询问 $x$ 与所有黑点的虚树,边权的 $\min$ 是多少。假设要判定答案是否 $\geq k$,那么就是询问 $x$ 只经过 $\geq k$ 是否能到达所有黑点,于是想到建立 Kruskal 重构树,那么 $x$ ......
题解 Codeforces Queries 825G Tree

「题解」Codeforces 1063F String Journey

先 reverse 一下。 不难看出选出的字符串长度为 $1,2,\cdots,k$ 一定不劣,仅考虑这种形式的。 然后考虑一手 dp,设 $f_{i}$ 表示最后一个子串是 $i$ 为结尾,最长长度是多少。 这样转移就是 $f_i\gets f_{j}+1,iff\ s[j-f_j+1,j]\te ......
题解 Codeforces Journey String 1063F

Educational Codeforces Round 153 (Rated for Div. 2)

# Preface 最近CF状态烂得一批,已经连续两场被D题腐乳了,再这样下去就真成抱队友大腿的混子了 但没想到因为D题比赛时贪心过的人太多了,后面一波叉掉了比赛时过的$\frac{1}{3}$的人导致竟然还能上分我是没想到的 没抓住暑假大好的上分机会,等开学后再想冲分就难咯 # A. Not a ......
Educational Codeforces Round Rated 153

Codeforces Round 893 (Div. 2) A-C题解

CF 893 (Div.2) A. Buttons 签到题。两人会优先选择c中的按钮来,避免自己的按钮消耗同时减少对方可选择的按钮。所以c % 2 == 1等价于a的按钮数+1,c % 2 == 0时相当于c按钮不存在,比较a b 按钮的数量来得出答案即可。 #include<iostream> u ......
题解 Codeforces Round 893 A-C

Educational Codeforces Round 153 (Rated for Div. 2) C题题解

CF Edu 153 C. Game on Permutation 设必胜态指从这一格开始开始行动的某人一定能获胜,必败态同理。 从左到右遍历序列,如果左方有比自己的值的必输态,那么这一格一定可以转移到此必输态,所以这一格一定是必胜态 如果没有比自己的值小的必输态,则 比自己值小的均为必胜态。 此格 ......
题解 Educational Codeforces Round Rated

Codeforces Round 893 Div.2 A~E2

# [Codeforces Round 893 Div.2 A~E2](https://codeforces.com/contest/1858) [CF1858A](https://www.luogu.com.cn/problem/CF1858A) > 有 $a+b+c$ 个球。 > 其中的 $a$ ......
Codeforces Round 893 Div E2

Educational Codeforces Round 153 (Rated for Div. 2) A-A题解

# A. Not a Substring ### 题解 对于这个题,我们可以考虑两种可能的连续的子串: - 有两个及以上的相同的字符,比如`(((`,`()))`,那么我们就需要尽可能地构造出连续不相同的字符串,比如`()()()`就非常符合我们的要求,每一对都不一样。 - 有两个及以上的不相同的字 ......
题解 Educational Codeforces Round Rated

Codeforces EduRound153 Editorial

# A 如果有 $()$ 那么肯定是不合法的 有两种很简单的构造,`()()()()...()` 和 `((((...))))`,如果一个串是第一种构造的子串那么一定不是第二种构造的子串,反之亦然。 使用 python 取之 # B 把 $m\% k$ 的余数补齐,再把多出来的 $1$ 价格 reg ......
Codeforces Editorial EduRound 153

Educational Codeforces Round 153 (Rated for Div. 2)

Educational Codeforces Round 153 (Rated for Div. 2) A - Not a Substring 思路:找到串中最大的层数,若层数为1,构造层数大于1的即可;若层数大于1,构造层数为1的即可 #include<bits/stdc++.h> using n ......
Educational Codeforces Round Rated 153

CF1842E

[原题](https://codeforces.com/contest/1842/problem/E) [翻译](https://www.luogu.com.cn/problem/CF1842E) 挺好的dp题,tsx推荐XD 首先可以发现如果两个三角形有交肯定不优,于是我们考虑按照$x \leq ......
1842E 1842 CF

CodeForces 1860D Balanced String

[洛谷传送门](https://www.luogu.com.cn/problem/CF1860D "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1860/D "CF 传送门") 首先考虑一个子问题,给两个只含有 $0$ 和 $ ......
CodeForces Balanced String 1860D 1860

CodeForces 1860E Fast Travel Text Editor

[洛谷传送门](https://www.luogu.com.cn/problem/CF1860E "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1860/E "CF 传送门") 没场切。/ng 考虑将原问题转成: > 给长度为 ......
CodeForces Editor Travel 1860E 1860

Educational Codeforces Round 153 (Rated for Div. 2)

# Educational Codeforces Round 153 (Rated for Div. 2) 这次的div2有点难度,当时b题思路对了,但是没有写好 [A题传送门](https://codeforces.com/contest/1860/problem/A) ## A题意: 给你一个只 ......
Educational Codeforces Round Rated 153

P1216 [USACO1.5] [IOI1994]数字三角形 Number Triangles

P1216 [USACO1.5] [IOI1994]数字三角形 Number Triangles 一个DP题,不是贪心!!! 话不多说,上代码 1 #include<iostream> 2 #include<cstdio> 3 #include<cmath> 4 #include<iomanip> ......
三角形 Triangles 数字 Number USACO1

Codeforces Round 881 (Div. 3)

比赛链接:https://codeforces.com/contest/1843 ## A. Sasha and Array Coloring **题意**:一个数组,可以任意分成任意组,每组的贡献是组最大值减最小值,求最大总贡献 **思路**:一组内只有最大值和最小值有用,所以每组只由两个数组成即 ......
Codeforces Round 881 Div

Codeforces Round 893 (Div. 2)

# Preface 最战俘的一场,B题写挂一发后整个人脑子就不清醒了,放着D不写去写E1,然后忘了可持久化栈有一个经典的倍增写法,最主要当时暑假前集训我还上去讲了这个东西然后比赛的时候还没想起来 后面目送徐神爆切5题成功完成两场从蓝上橙,狠狠地把我这个在紫卡了半年的废物羞辱了一波 不过确实说实话我们 ......
Codeforces Round 893 Div

Educational Codeforces Round 109 (Rated for Div. 2)

Educational Codeforces Round 109 (Rated for Div. 2) A - Potion-making 思路:求最小操作数即药水最简比 #include<bits/stdc++.h> using namespace std; #define int long lo ......
Educational Codeforces Round Rated 109

Codeforces Round 883 (Div. 3)

比赛链接:https://codeforces.com/contest/1846 ## A. Rudolph and Cut the Rope **题意**:给n条绳子,知道一端所在高度坐标和各自绳长,他们另一端都连到一个糖果上,问至少剪掉多少绳子糖果能碰到地面 **思路**:显然只有坐标小于绳长的 ......
Codeforces Round 883 Div

Codeforces Round 892 (Div. 2)

# Codeforces Round 892 (Div. 2) [TOC] ## A United We Stand > 给定长度为$n$的数组`a`,可以将`a`中元素添加到空数组`b`或`c`中,满足两个数组均非空,且`c`中的元素不是`b`中元素的约数。若不能满足输出`-1`。 `c`中的元素 ......
Codeforces Round 892 Div

2023.08.12 codeforces round 893 div2

年轻人的第四场div2 rank:8217 solved:2 rating change:+31 new rating:1354 A.Buttons 题意:给定a,b,c三种按钮的数量,a按钮只能被Anna按,b按钮只能被Katie按,两个人都可以按c按钮,最后没有按钮可以按的人输,Anna先手,问 ......
codeforces round 2023 div2 893

Codeforces Round 891 (Div. 3)

比赛链接:https://codeforces.com/contest/1857 ## A. Array Coloring **题意**:一个数列,问能否分成两个和的奇偶性相同的集合 **思路**:因为偶数不改变奇偶性,咱们就统计奇数的个数,能平分成两组就行 ## B. Maximum Roundi ......
Codeforces Round 891 Div

Educational Codeforces Round 107 (Rated for Div. 2)

Educational Codeforces Round 107 (Rated for Div. 2) A - Review Site 思路:数1和3的个数 #include<bits/stdc++.h> using namespace std; #define int long long //#d ......
Educational Codeforces Round Rated 107

Codeforces Round 765 (Div. 2) A-E

## **A. Ancient Civilization** 好像就是对每个二进制位看一下0多还是1多,选择多的那个数就好了。 vp的时候直接猜的,交了一发直接过了 ```cpp void solve(){ int n=read(),m=read(); vectorcnt0(m+1),cnt1(m+ ......
Codeforces Round 765 A-E Div

Codeforces Round 893 (Div. 2)

Codeforces Round 893 (Div. 2) A - Buttons 思路:将第三种按钮平分给两人,若第一个人的按钮数大于第二个人则First #include<bits/stdc++.h> using namespace std; #define int long long //#d ......
Codeforces Round 893 Div

Codeforces Round 893(div2)

# Codeforces Round 893(div2) [A题传送门]([Problem - A - Codeforces](https://codeforces.com/contest/1858/problem/A)) ## A题意: 我们有a+b+c个瓶盖,选手1可以拿指定的a个或者c个里面的 ......
Codeforces Round div2 893 div

CodeForces 1858D Trees and Segments

[洛谷传送门](https://www.luogu.com.cn/problem/CF1858D "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1858/D "CF 传送门") 美丽度的式子可以写成 $(a - 1) \tim ......
CodeForces Segments 1858D Trees 1858

Codeforces Round 892 (Div. 2)

# Codeforces Round 892 (Div. 2) ## A. United We Stand ### 简述题意 给定一个长度为 $ n $ 的数列 $ a $ ,要求将 $ a $ 的每个元素分配到数列 $ b $ ,$ c $ 中,满足以下两个要求 1. $ b,c $ 不为空,即 ......
Codeforces Round 892 Div

Codeforces Global Round 15

Codeforces Global Round 15 A - Subsequence Permutation 思路:找出原串与排序后的串不同的个数 #include <bits/stdc++.h> using namespace std; void solve(){ int n;cin>>n; st ......
Codeforces Global Round 15

Codeforces Round 892 (Div. 2) A-E

## A. United We Stand 题意:给出一个长为$n$的数组$a$,将其中的元素分别放到空数组$b$和$c$中,使得$c$中的任意一个元素都不是$b$中任意一个元素的因数,并且两个数组都不是空数组 ### Solution 把$a$中最小的数放到$b$,其它的都放到$c$,一定可以保证 ......
Codeforces Round 892 A-E Div

[补题] Codeforces Round 892 (Div. 2)

## Codeforces Round 892 (Div. 2) ~~感觉被诈骗了ww~~ ### A #### Translate & Description 你有一个$a$数组,你可以将$a$数组的每一个数放到$b$数组或者$c$数组中。构造完后你需要确保$\forall b_i$%$\fora ......
Codeforces Round 892 Div