rounding maximum 1857b cf

Educational Codeforces Round 33 (Rated for Div. 2)

# Educational Codeforces Round 33 (Rated for Div. 2) https://codeforces.com/contest/893 昨日vp,今日补完F D贪心,思路值得学习; E组合数学推式子,式子不难,关键在于模型抽象 F主席树,调了老半天,关键在于要 ......
Educational Codeforces Round Rated Div

Codeforces Round 896 Div2 A-D题解

# Codeforces Round 896 ## A. Politics 这题问的是,给一些人的在n个议题的观点,然后你可以随意安排顺序,每个议题人多的赢,反对派会离开,问随便安排议题,最多留下多少人,包括我自己 这个题刚开始愣了半天,但是想到,那只要把所有和我观点一致的给留下来不就行了???然后 ......
题解 Codeforces Round Div2 896

LOJ #6160. 「美团 CodeM 初赛 Round A」二分图染色 思考--zhengjun

[link](https://loj.ac/p/6160) 思维+容斥计数。 首先的转化比较妙,二分图转化为 $n\times n$ 的网格图染色。 > 与网络流的转化方向相反,值得注意。 然后发现两种颜色(红、蓝)如果独立染色,同一个格子可能会重复染色。 考虑容斥,式子很好列,直接容斥即可。 $$ ......
初赛 zhengjun CodeM Round 6160

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

[比赛链接](https://codeforces.com/contest/1831) # A ## 代码 ```c++ #include using namespace std; using ll = long long; bool solve() { int n; cin >> n; for ( ......
Codeforces Round 875 A-D Div

题解 CF1842H【Tenzing and Random Real Numbers】

看了题解。好难受,想用积分求概率,算了半天。发现没啥规律,不是不能算,就是太可怕了。 ## Problem 有 $n$ 个 $[0,1]$ 范围内的均匀随机变量 $x_{1\cdots n}$ 和 $m$ 条限制,每条限制形如 $x_i+x_j\le 1$ 或 $x_i+x_j\ge 1$。请你求出 ......
题解 Tenzing Numbers Random 1842H

Codeforces Round 884

[TOC] ### 写在前面 比赛地址:[https://codeforces.com/contest/1844](https://codeforces.com/contest/1844)。 什么?你怎么知道我连 C 都没过掉了一伯伍拾昏? 吐槽一下马娘前期甚至动画第一季都没出之前的很多个人角色曲, ......
Codeforces Round 884

Educational Codeforces Round 137 (Rated for Div. 2)

Educational Codeforces Round 137 (Rated for Div. 2) A. Password void solve(){ int n=read(); for(int i=1;i<=n;i++)int x=read(); cout<<combination(10-n, ......
Educational Codeforces Round Rated 137

[论文阅读] CF-Font@ Content Fusion for Few-shot Font Generation

## 1. Pre title: CF-Font: Content Fusion for Few-shot Font Generation accepted: CVPR2023 paper: https://arxiv.org/abs/2303.14017 | https://openaccess. ......
Font Generation Few-shot CF-Font Content

题解 CF1784E【Infinite Game】

## solution DP。 - 0:前面是空的。 - 1:一只落单的 $a$。 - 2:一只落单的 $b$。 - 3:正在决斗的 $ab$ - 4:正在决斗的 $ba$。 画出一个有向图。 ......
题解 Infinite 1784E 1784 Game

CF1364E X-OR

# CF1364E X-OR 用这题总结一下交互题中的一种套路。 询问两个数的 or,给了我们两个想法。 1. 按位确定每个数。 2. **找到某些关键数,之后快速求出剩下的数**。 对于第一种想法,发现询问次数比较少,很难有优秀的做法,那么就考虑第二种。 先考虑找到怎样的关键数能够更好地帮助解题。 ......
1364E 1364 X-OR CF OR

CF1425D

一道计算方式很具有启发意义的题。 对于这种“选中产生贡献”的题,明显是需要对每个点算对总答案的贡献。但是由于“和的平方”的存在,这很难实现。 所以不妨在上面思路的基础上稍作改良:对每两个点算对总答案的贡献。不难发现,贡献的次数即为两个点都被选中的情况数。设 $a,b,c$ 分别为包含第一个点,包含第 ......
1425D 1425 CF

Codeforces Round #881 (Div. 3) A-F

[比赛链接](https://codeforces.com/contest/1843) # A ## 代码 ```c++ #include using namespace std; using ll = long long; int a[57]; bool solve() { int n; cin ......
Codeforces Round 881 A-F Div

Codeforces Round 882 (Div. 2) A-E

Codeforces Round 882 (Div. 2) 2023.7.6 这场还有意思,出题的背景都很相似,通过不同的操作实现不同的要求。 ......
Codeforces Round 882 A-E Div

Codeforces Round 881 (Div. 3) D - Apple Tree(dfs)

https://codeforces.com/contest/1843/problem/D ``` 题目大意: 一颗树中,每次给定两个结点,每个结点都可以移动到孩子结点,最后可以到达叶子结点, 问我们这两个结点最终移到叶子结点有多少种组合? (其实就是让求以这两个节点为根的子树的叶子结点个数的乘积) ......
Codeforces Apple Round Tree 881

【图论】CF1508C Complete the MST

[Problem Link](https://codeforces.com/contest/1508/problem/C) 有一张 $n$ 个点的完全图,其中 $m$ 条边已经标有边权。你需要给剩下的边都标上权值,使得所有边权的异或和为 $0$,并且整张图的最小生成树边权和最小。 $n,m\le 1 ......
Complete 1508C 1508 the MST

CF1844E. Great Grids

# 题目大意 有一个n\*m的网格图,需要在每个格子内部填入A~C,要求满足: ① 每个2\*2的小方格都要有ABC ② 边相邻格子内字母不同 给出初始若干格子相同(满足角相邻)的限制,判断是否存在合法解 2 #define fo(a,b,c) for (a=b; a=c; a--) #define ......
Great Grids 1844 CF

CF1844F Min Cost Permutation

[题面传送门](https://www.luogu.com.cn/problem/CF1844F2) 先不考虑字典序的问题,只考虑最小值怎么求。 先考虑一个特殊情况:$c=0$,也就是说我想要相邻两项之差的绝对值最小。那么将其从小到大排序以后就满足要求。 我们猜想实际上更一般的情况不会和这个差太多。 ......
Permutation 1844F 1844 Cost Min

Codeforces Round 875 (Div. 2)

Codeforces Round 875 (Div. 2) A - Twin Permutations 思路:让序列全相等为n+1即可 #include<bits/stdc++.h> using namespace std; typedef pair<int,int>PII; typedef pai ......
Codeforces Round 875 Div

SMU Summer 2023 Contest Round 1

SMU Summer 2023 Contest Round 1 A - The Contest 思路:求出最短解决问题总时间,在所有区间找出大于等于总时间的最短时刻。 #include<bits/stdc++.h> using namespace std; #define int long long ......
Contest Summer Round 2023 SMU

SMU Summer 2023 Contest Round 2

SMU Summer 2023 Contest Round 2 A - Treasure Hunt 思路:判断 Δx 和 Δy 能否分别整除 x 和 y ,求出需要的步数,两者的步数须同奇或同偶 #include<bits/stdc++.h> using namespace std; //#defi ......
Contest Summer Round 2023 SMU

SMU Summer 2023 Contest Round 3

SMU Summer 2023 Contest Round 3 A - Curriculum Vitae 思路:要求0后不能有1,当某个数都不删时,值为前面所有的0的个数加后面所有1的个数,求出最大即可 #include<bits/stdc++.h> using namespace std; #de ......
Contest Summer Round 2023 SMU

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

Codeforces Round 884 (Div. 1 + Div. 2) A - Subtraction Game 思路:显而易见为a+b #include<bits/stdc++.h> using namespace std; #define int long long typedef pai ......
Codeforces Div Round 884

SMU Summer 2023 Contest Round 3

[A. Curriculum Vitae](http://https://codeforces.com/group/L9GOcnr1dm/contest/450890/problem/A "A. Curriculum Vitae") 题意:给出一串01序列,可以删除任意个元素,使得1后面没有0 思路 ......
Contest Summer Round 2023 SMU

CF339 题解

# CF339 题解 这套题虽然是div2,但是具有一定的价值,这套题作为典型的div2题目,全套5道题都几乎用暴力方法解决,但是为什么这样是对的?令人深思。 ### A 红题,把个位数提出来再排序就好了。 ```cpp #include using namespace std; const int ......
题解 339 CF

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

SMU Summer 2023 Contest Round 2

[A. Treasure Hunt](http://https://codeforces.com/group/L9GOcnr1dm/contest/450889/problem/A "A. Treasure Hunt") 题意:给出船的出发位置和目的地,给出四种移动方式。 思路:路程要被整除。横移纵 ......
Contest Summer Round 2023 SMU

SMU Summer 2023 Contest Round 1

[A. The Contest](http://https://codeforces.com/group/L9GOcnr1dm/contest/450888/problem/A "A. The Contest") 题意:要做n道题,每道题花费时间a[i],但是只有几个时间段可以提交,问最早什么时间可 ......
Contest Summer Round 2023 SMU

CF1220F Gardener Alex 题解--zhengjun

发现根节点一定是 $1$,所以考虑两边的子树深度,然后发现只需要考虑一段后缀或前缀的深度即可。 所以循环位移后,可以从中间往两边构建笛卡尔树,实时维护深度即可。 ### 代码 ```cpp #include using namespace std; using ll=long long; const ......
题解 Gardener zhengjun 1220F 1220

CF1175F The Number of Subpermutations 对自己的警告--zhengjun

太久没见过启发式合并了,然后没想出做法。 首先笛卡尔树建出来。 然后直接枚举跨过 $mid$ 的长度为 $a_{mid}$ 的区间,RMQ $O(1)$ 验证即可。 发现这样的区间个数不超过左右区间大小的较小值,时间复杂度:$O(n\log n)$。 ### 代码 ```cpp #include u ......
Subpermutations zhengjun Number 1175F 1175