codeforces 1856d wrong more

Codeforces 1305G Kuroni and Antihype

考虑若 $a_u\operatorname{bitand} a_v = 0$,则连 $(u, v, a_u), (v, u, a_v)$ 两条单向边,答案即为外向森林边权和最大值。 发现这是个森林,那考虑增加一个虚点 $a_{n + 1} = 0$,这样就变成了一个树,然后能发现 $1\sim n$ ......
Codeforces Antihype Kuroni 1305G 1305

Codeforces 1092D1 Great Vova Wall (Version 1)

发现不管 $a_i$ 多大都可以一直 $a_i\leftarrow a_i + 2$ 使所有 $a_i$ 的取值变为两个相邻的数,那就只需要考虑奇偶的限制了。 发现若 $2$ 个奇偶相同的 $a_i, a_{i + 1}$,那这 $2$ 个数的奇偶性就可以变化。 所以可以维护一个栈,若栈顶 $2$ ......
Codeforces Version 1092D1 1092D Great

Codeforces Round 883 (Div. 3)

Codeforces Round 883 (Div. 3) A. Rudolph and Cut the Rope: 题意: 有一个糖果由n个绳子悬挂,告诉每一个绳子位于的高度和宽度,问至少间断几根才可以让candy回到groud。 思路: 统计有几个宽度小于高度的绳子即可 void solve() ......
Codeforces Round 883 Div

Codeforces Round 875 (Div. 2)(D)

# Codeforces Round 875 (Div. 2)(D) ## D (思维) 这个题意是给你两个数组,$a$和$b$,我们需要找到这样的二元组$(i,j)$满足$a_i\times a_j=b_i+b_j$,问一共有多少组满足以上条件的二元组 题目还告诉我们数组里面的数字都是不大于$n$ ......
Codeforces Round 875 Div

Codeforces Round 882 (Div. 2)

# Preface 这场现场打的,顶着第二天一早起来军训硬打到一点 这场题目都是JOJO确实好评,但刚开始的评测姬爆让人很难顶啊,因为这个B题挂了一发没法第一时间改导致这场罚时裂开了 这场写完D还有快50min,然后看一眼榜E出的人很少但是F好多人过 然后就去想F,由于军训生物钟的缘故当时好困好困, ......
Codeforces Round 882 Div

Codeforces Round 882 (Div. 2) C. Vampiric Powers, anyone?

由题目观察可得,a[m+1]=a[i]^...a[m],,结合异或的性质a^b^a=b,可得如果在末尾添加一个a[m+1],a[m+1]会和末尾几个抵消掉,求得i~k这一段的异或和,k<m,因此通过该操作实际上我就可以求得所有长度连续区间的异或和,求其最大值,n=1e5+10,如果暴力求解肯定会超时 ......
Codeforces Vampiric Powers anyone Round

Codeforces Round 882 (Div. 2) A-D

AThe Man who became a God 假设sum为 omiga abs(a[i] - a[i -1]) 1 <= i <= n 只有设置断点的时候,假设设置在t和t-1之间 the value才会减少abs(a[t]-a[t-1]) 所以把差距最大的几个地方分段就行了 #include ......
Codeforces Round 882 A-D Div

Educational Codeforces Round 151 (Rated for Div. 2) D. Rating System

贪心 由题可得,对于k的选择一定是单调递增的,对于前面选定的k后面选的k必须大于之前选的才会发生新的变化,因此k的选择其实是一个单调栈,由前缀和组成 我们要想最后的结果最大,则k值一定要尽可能的高,例如当选中i为k值时,如果从i后面某个原本的前缀和要大于选k之后所得到的前缀和的话,说明k不是最优的 ......
Educational Codeforces Rating System Round

Codeforces Round 882 (Div. 2) - C

# [C. Vampiric Powers, anyone?](https://codeforces.com/contest/1847/problem/C) **题意:** 给你n个数,你可以进行任意次操作,每次操作你可以从数组最后往前选择任意个连续的数并将其异或和的结果放置在数组末尾,问你操作过程 ......
Codeforces Round 882 Div

Educational Codeforces Round 151 (Rated for Div. 2) C. Strong Password

题目翻译,给定t组数据,每组数据包含一个字符串s,两个长度为m的字符串l和r,要求判断是否存在一个长度为m的字符串res,满足l[i]<=res[i]<=r[i](i->0~m)且不是s的子序列 贪心 首先对于所有满足l<res<r的字符串,我们只需判断是否存在一个字符串不是子序列即可,那么我们让r ......
Educational Codeforces Password Strong Round

Codeforces Round 879 (Div. 2)

# Preface 补题 其实这场题目昨天基本就写好了,但因为昨天晚上有CF所以博客就先没写,鸽到今天才补 这场的难度只能说有点过于简单了,D之前都是一眼题,E最近学校那边做过类似的题目,F读懂题意后想到关键后也是个丁真题 # A. Unit Array 为了偷懒我就直接枚举最后有多少个$-1$了 ......
Codeforces Round 879 Div

Codeforces Round 882 (Div. 2) 题解(A ~ D)

比赛地址 A. The Man who became a God 题意: 给定含有n个元素的数组,将数组分成m段,计算m段 f (l, r) 的最小值 思路: 容易发现 | ai - ai + 1 | 是两个元素差的绝对值,分成m段,也就是有 m - 1个绝对值不用计算,所以只需要除去 m - 1 ......
题解 Codeforces Round 882 Div

Codeforces Round 882 (Div. 2) C

被c题的题意骗了 ## C. Vampiric Powers, anyone? ### 题意 转换一下原题的题意,就是求一个连续子区间的最大异或和。 ### 思路 异或有一个性质,即$a\oplus b\oplus b=a$,原题题意也是利用这个性质转化的。现在可以利用这个性质求出子区间的异或和。 ......
Codeforces Round 882 Div

CodeForces 1142E Pink Floyd

[洛谷传送门](https://www.luogu.com.cn/problem/CF1142E "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1142/E "CF 传送门") 感觉很神奇啊,想了挺久的。 如果没有粉色边是容易 ......
CodeForces 1142E Floyd 1142 Pink

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

# A ## 代码 ```c++ #include using namespace std; using ll = long long; int cnt[107]; bool solve() { int n; cin >> n; for (int i = 0;i > x, cnt[x]++; for ......
Codeforces Round 880 A-D Div

Educational Codeforces Round 151 (Div. 2) C

卡c题了,用双指针做的,赛后发现不用双指针也行。 ## C. Strong Password ### 题意 给定1个字符串$s$,和两个长度相同的字符串$l,r$,字符串的所有元素都在0~9之间。求是否存在一串字符,其中每个数字都在对应位置$l,r$的数字之间,且该字符串不能是$s$的子序列。 ## ......
Educational Codeforces Round 151 Div

Codeforces Round 840 E - Node Pairs

# E - Node Pairs 题目链接:[E - Node Pairs](https://codeforces.com/contest/1763/problem/E "E - Node Pairs") ## 题意 题意晦涩难懂,但理解了之后就发现是让计算两个值: 1.最小的n使得一个具有n个点的 ......
Codeforces Round Pairs Node 840

题解-Codeforces Round 805 (Div. 3) E. Split Into Two Sets

# 题解-Codeforces Round 805 (Div. 3) E. Split Into Two Sets (原题链接)[[Problem - E - Codeforces](https://codeforces.com/contest/1702/problem/E)] ## 思路 **知识 ......
题解 Codeforces Round Split Into

Codeforces Round 880 (Div. 2)

# Preface 补题 最近被太阳晒得全身发痒,而且手臂还红的要死,不过每天有大把时间可以用来想题写题还是很爽的 这场的题目就突出一个诡异,DE都是只可意会不可言传的做法,给闪总人干麻了 # A. Destroyer 设$num_i$表述数$i$出现的次数,则必须对所有的$i$都要满足$num_i ......
Codeforces Round 880 Div

【补题记录】 Codeforces Round 797 (Div. 3) F Shifting String(置换环)

##思路: 根据这个排列进行替换的操作可以往置换环考虑,就是对于每一段字串,它的变换都是有规律的,经过一定的操作之后都会回到原点,可以想象转化成图上问题。 参考ygg的题解,直接用链表模拟这个转化的过程,然后暴力计数,因为要满足所有点都回到对应原位,所以求所有满足条件的长度之后求lcm即可 点击查看 ......
Codeforces Shifting String Round 797

Codeforces Round 879 (Div. 2)

其实昨天就应该写了,不过D不太会,但是今天补题发现D还是不太会 A: 给定包含-1和1的数字序列,要求满足这个序列 并且你可以将序列中的-1改成1,也可以将序列中的1改成-1, 让你确定将一个随机序列改成满足要求的序列的最小操作数 1 #include<cstdio> 2 #include<cstr ......
Codeforces Round 879 Div

Educational Codeforces Round 150 A~D

c题好难。 ## A. Game with Board [Problem - A - Codeforces](https://codeforces.com/contest/1841/problem/A) ### 题意 给定若干个数字1,Alice和Bob每回合合并两个相同的数字,Alice先手。如果 ......
Educational Codeforces Round 150

Codeforces Round 879 (Div.2) B ~ D

D题补了一天... ## B. Maximum Strength [Problem - B - Codeforces](https://codeforces.com/contest/1834/problem/B) ### 题意 给定两串数字,在这两串数字之间找两串数字,要求每一数位之差的绝对值之和最 ......
Codeforces Round 879 Div

Codeforces Round 872 (Div.2) A~C

洛天依专场QWQ ## A. LuoTianyi and the Palindrome String [Problem - A - Codeforces](https://codeforces.com/contest/1825/problem/A) ### 题意 给定一个回文串,求最长的非回文子串的 ......
Codeforces Round 872 Div

Codeforces Round 870 (Div.2) A~C

vp时A题没写出来,场外找的答案,原来思路错了(心虚 ## A. Trust Nobody [Problem - A - Codeforces](https://codeforces.com/contest/1826/problem/A) ### 题意 有n个人,其中一些人只说真话,另外一些人只说谎 ......
Codeforces Round 870 Div

Codeforces Round 864 A~C

vp过三题,c是交互题,想起了打华师大校赛时的不愉快经历了。 ## A.Li Hua and Maze [Problem - A - Codeforces](https://codeforces.com/contest/1797/problem/A) ### 题意 给定一个n×m的矩阵,矩阵中有两个 ......
Codeforces Round 864

codeforces 树上题目总结

### codeforces 树上题目总结 **[CF1559D2](https://www.luogu.com.cn/problem/CF1559D2)** 先猜一个结论——一定能通过加边让一个森林变成一棵树,归纳一下发现是对的,并且随便加合法的边都符合条件,所以暴力是 $\mathcal O(n ......
codeforces 题目

Educational Codeforces Round 151 (Rated for Div. 2) A-D

# A ## 代码 ```c++ #include using namespace std; using ll = long long; bool solve() { int n, k, x; cin >> n >> k >> x; if (x != 1) { cout = 3) { if (k > ......
Educational Codeforces Round Rated 151

Codeforces 293B Distinct Paths

发现 $n, m$ 的数据范围是假的,因为每一步一个颜色最多也就 $k\le 10$ 种颜色,所以当 $n + m - 1 > k$ 时一定无解。 接下来发现这个数据范围挺小的,考虑状压,设 $f_{x, y}$ 为走到 $(x, y)$ 点所用的颜色的集合,其可以由 $f_{x - 1, y}, ......
Codeforces Distinct Paths 293B 293

Codeforces Round 878 (Div3)

## B. Binary Cafe >![image-20230703193601400](https://zeoy-typora.oss-cn-hangzhou.aliyuncs.com/image-20230703193601400.png) > >$1 \leq n,k \leq 10^9$ ......
Codeforces Round Div3 878 Div