rounding maximum 1857b cf

CF1010F Tree

**题意**: - 给定一棵根为 $1$ 的二叉树 $T$,根上有 $x$ 个水果。 - 某些枝条(二叉树的边)会断掉,留下一个包含根节点的联通块 $T'$。 - 给剩下的 $T'$ 中每个点 $u$ 赋点权 $a_u$ 表示这个点上的水果数量,满足 $a_1=x$ 并且 $a_u\ge \sum\ ......
1010F 1010 Tree CF

Codeforces Round #888 (Div. 3) A-G

[比赛链接](https://codeforces.com/contest/1851) # A ## 代码 ```c++ #include using namespace std; using ll = long long; bool solve() { int n, m, k, H; cin >> ......
Codeforces Round 888 A-G Div

Codeforces Round 888 (Div. 3) - D

[toc] Codeforces Round 888 (Div. 3) 赛后摘记 # [D. Prefix Permutation Sums](https://codeforces.com/contest/1851/problem/D) **题意** 判断给定的长为n - 1数组,是否为某个 1 ~ ......
Codeforces Round 888 Div

Codeforces Round 888 (Div. 3)

# A. Escalator Conversations ```cpp #include using namespace std; #define int long long void solve(){ int n , m , k ,H; cin >> n >> m >> k >> H; vecto ......
Codeforces Round 888 Div

CF1184A3 Heidi Learns Hashing (Hard)

令 $c_i={w_1}_i-{w_2}_i$,相当于找到 $(r,P)$,满足: $$\sum\limits_{i=0}^nc_ir^i\equiv 0 \pmod P$$ 把这个东西写成多项式形式,令 $f(x)=\sum\limits_{i=0}^nc_ix^i$,即找到一个 $(r,P)$, ......
Hashing Learns 1184A Heidi 1184

43. CF-Walk the Runway

[Walk the Runway](https://codeforces.com/contest/1826/problem/E) 题意有点绕,在这里先简单解释一下: 有 $n$ 个人和 $m$ 个城市,每个人都有一个贡献值 $p_i$,每个人对每个城市有一个打分 $r_{i,j}$。现在需要选出 $ ......
CF-Walk Runway Walk the 43

1798.maximum number of consecutive values you can make

Description 1798.maximum-number-of-consecutive-values-you-can-make Solution Greedy algorithm + dynamic programming First, we sort the array in ascendi ......
consecutive maximum number values 1798

[CF1601C] Optimal Insertion

# Optimal Insertion ## 题面翻译 ### 题目大意 给定两个序列 $a,b$,长度分别为 $n,m(1\leq n,m\leq 10^6)$。接下来将 $b$ 中的所有元素以**任意方式**插入序列 $a$ 中**任意位置**,请找出一种插入方式使结果序列中的逆序对数量最小化, ......
Insertion Optimal 1601C 1601 CF

Codeforces Round 888 (Div. 3)

Codeforces Round 888 (Div. 3) A - Escalator Conversations 思路:求出每个人与Vlad的身高差d,若的能被k整除,且d/k<m则YES #include<bits/stdc++.h> using namespace std; #define i ......
Codeforces Round 888 Div

Codeforces Round 888 (Div. 3)F(异或小技巧)

题意:给你一个数组长度为n的a数组,要求a数组的值为非负整数,再给你一个k,a的值全小于2的k次方,找到一个小于a的k次方的值x,再从a中找到两个值,让他们 (ai⊕x)&(aj⊕x)最小 结论:n个数的最小异或对的答案就是排序后最小的相邻异或和 思路:(ai⊕x)&(aj⊕x)的最高位为1,可以把 ......
Codeforces 技巧 Round 888 Div

【题解】Educational Codeforces Round 150(CF1841)

赛时过了 A-E,然后就开摆了,为什么感觉 C 那么无厘头[发怒][发怒] 排名:25th ## A.Game with Board ### 题目描述: Alice 和 Bob 玩游戏,他们有一块黑板。最初,有 $n$ 个整数 $1$。Alice 和 Bob 轮流操作,Alice 先手。 轮到时,玩 ......
题解 Educational Codeforces Round 1841

CF1853C Ntarsis' Set

[Miku](https://codeforces.com/contest/1853/problem/C) 一道逆向思维的题目。 我们假设最后的最小的数是个1,放在第一个位置上,然后我们往数列开头按照规则插入0,其中应该插在这个1后面的,我们视为无效插入,插在这个1前面的,我们视为有效插入。 显然随 ......
Ntarsis 1853C 1853 Set CF

CF1776M Parmigiana With Seafood 题解

先将所有的叶子取 $\max$ 贡献给答案,以下讨论的所有点中不考虑叶子。 首先可以考虑先手能否删到 $n$:不难发现当 $2 \mid n$ 的时候可以,然后我们就排除了一半的 $n$,于是以下令 $2 \not \mid n$。接下来,考虑先手能否删掉 $n-1$,那么把 $n-1 \to n$ ......
题解 Parmigiana Seafood 1776M 1776

Codeforces Round 886 (Div. 4) D - H

D. Balanced Round E. Cardboard for Pictures F. We Were Both Children G. The Morning Star H. The Third Letter ......
Codeforces Round 886 Div

Codeforces Round 887 (Div. 2) D.Imbalanced Arrays

Problem - D - Codeforces 题目规定了一种“平衡数组”,数组中的任意一个数绝对值小于等于n且不等于零,任意两个数的和不为0,给n个数a[i],分别表示位于i的数可以与a[i]个数(包括它自己)相加为正。 现在给出n和a数组,要求构造平衡数组,不能构造的话输出-1 我们不难得出以 ......
Codeforces Imbalanced Arrays Round 887

题解 CF1844G【Tree Weights】

## problem 一棵树边带正整数权,给出所有 $dis(i,i+1)$,还原树的边权,或者无解。$n\leq 10^5,V\leq 10^{12}$。 ## solution 首先很容易得到 $n$ 个方程形如 $dep_1=0,dep_i+dep_{i+1}-2dep_{lca(i,i+1) ......
题解 Weights 1844G 1844 Tree

SMU Summer 2023 Contest Round 6

# [SMU Summer 2023 Contest Round 6](https://codeforces.com/group/L9GOcnr1dm/contest/462070) ## [A. There Are Two Types Of Burgers](https://codeforces. ......
Contest Summer Round 2023 SMU

题解 CF1601C【Optimal Insertion】

特别鸣谢: ## problem 两个数组 $a,b$ 长度分别为 $n,m$。将 $b$ 的所有元素以任意顺序插入 $a$ 的任意位置,使最终序列逆序对数量最小,并输出这个值。$n,m\leq 10^6$。 ## solution $b$ 明显是排序成不降的最优,$a$ 原来的逆序对个数无法改变, ......
题解 Insertion Optimal 1601C 1601

Educational Codeforces Round 35 (Rated for Div. 2)

# Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 ## A. Nearest Minimums ```CC #include using namespace std; con ......
Educational Codeforces Round Rated Div

Educational Codeforces Round 71 (Rated for Div. 2)

Educational Codeforces Round 71 (Rated for Div. 2) A - There Are Two Types Of Burgers 思路:价格高的优先取 #include<bits/stdc++.h> using namespace std; #define ......
Educational Codeforces Round Rated Div

Codeforces Round 887 (Div. 2) A-D

# Codeforces Round 887 (Div. 2) ## A. Desorting 题意:给出一个数组,可以进行任意次以下操作: 选择一个i 对于数组中的a[1],a[2],...,a[i]全部+1 a[i+1]...a[n]全部-1, 问最小使得数组变得无序的操作是多少次 ### So ......
Codeforces Round 887 A-D Div

题解 CF1501B 【Napoleon Cake】

posted on 2021-03-16 17:42:06 | under 题解 | [source](https://www.luogu.com.cn/blog/_post/319814) 题目可以转化一下:给一个长为 $n$ 的数组 $a$,请求出一个长为 $n$ 的数组 $b$。要求若 $a_ ......
题解 Napoleon 1501B 1501 Cake

题解 CF1501A 【Alexey and Train】

posted on 2021-03-13 21:57:02 | under 题解 | [source](https://www.luogu.com.cn/blog/_post/319230) 简单模拟题,考验选手的读题能力~~和使用谷歌翻译的能力~~。 先定义一个 $now=0$,我们最后算出来的结 ......
题解 Alexey 1501A Train 1501

题解 CF1497C1 【k-LCM (easy version)】

posted on 2021-03-20 08:26:53 | under 题解 | [source](https://www.luogu.com.cn/blog/_post/320621) 看数据范围,$1\leq T\leq10^4$,$1\leq n\leq 10^9$,显然是构造题。 我们分 ......
题解 version 1497C k-LCM 1497

题解 CF1497C2 【k-LCM (hard version)】

posted on 2021-03-20 09:09:40 | under 题解 | [source](https://www.luogu.com.cn/blog/_post/320635) 2023 编者注:有一些链接点不进去,分别是 cf1497c1 的 cf 页面和 此题与 [CF1497C1 ......
题解 version 1497C k-LCM 1497

918. Maximum Sum Circular Subarray (Medium)

Description 918. Maximum Sum Circular Subarray (Medium) Given a circular integer array nums of length n, return the maximum possible sum of a non-empt ......
Circular Subarray Maximum Medium 918

【大联盟】20230714 T1 三分网络(tri) 题解 CF1666K 【Kingdom Partition】

## 题目描述 [here](https://codeforces.com/problemset/problem/1666/K)。 ## 题解 赛时得分:$30/30$,想了很久网络流最后不会。 感觉这题就纯纯对脑洞,因为把题目中的 $2$ 改成 $3$ 就做不了)))不过还是相当有意思的。 考虑如 ......
题解 大联盟 Partition 20230714 Kingdom

CF1466I The Riddle of the Sphinx

### 基本思路 明示了在二进制下考虑问题,我们大体的思路就是从高往低依次确定最大的数二进制下每一位上的值。 以下所述的「前缀」均指一个二进制数从高位到低位的一部分,一个元素的「前 $k$ 位」表示二进制从高位到低位的前 $k$ 位,$res$ 表示当前记录的最大前缀的长度。 先看看操作能干嘛,一是 ......
Riddle Sphinx 1466I 1466 The

【大联盟】20230713 T1 方向矩阵(rect) 题解 CF1666A 【Admissible Map】

## 题目描述 [here](https://www.luogu.com.cn/problem/CF1666A)。 ## 题解 赛时得分:60/100。 想到了正解,但调不出来,就改写暴力了。。。 首先,我们把问题转化成每个点都入度为 $1$。 我们考虑合法子串只有两种形式: 注意到 `U` 和 ` ......
题解 矩阵 大联盟 Admissible 20230713

CF1051G Distinctification题解

[link](https://www.luogu.com.cn/problem/CF1051G) 首先可以发现,题目给定的两种操作为我们提供了“反悔机制”,所以有: 结论 $1$:即任何一个可以到达的局面都能到达最优解。 利用这个结论,首先我们先去重。 继续提炼性质,与相差不到 $1$ 的数为基准 ......
题解 Distinctification 1051G 1051 CF