rounding maximum 1857b cf
CF 1853 E
首先,所有的都$\mod k$。$i+1$ 的最优一定从 $i$ 的最优转化而来。也就是这题让我们做出最优的 $extend$。 可以算一下样例。`1 2 3 1 3 2 1` 的答案依次为 `1 2 3 3 4 4 4`。可以得到一个 observation: - observation:当在走下 ......
题解 Codeforces Round 887 (Div 1+Div 2) / CF1853AB,CF1852ABCD
下大分!悲!Div 1 只过了 1A!!! 但还是补完整场 Div 2 吧。 # A. Desorting ## problem 用操作:$[1,i]++,[i+1,n]--$,使得数组不单调不降,求最小操作次数。$n\leq 10^5$。 ## solution 操作等同于在差分数组上选出 $i$ ......
CF923E Perpetual Subtraction
参考了 cmd 的多项式计数杂谈,拜谢。 考虑题目给定的其实就是 $x$ 分布的 PGF $F(x)$。那么令 $F_i(x)$ 表示操作了 $i$ 轮后 $x$ 的 PGF,则 $F_0(x)=F(x)$。 考虑一次操作对 $x$ 的影响,若操作成了 $k$: $$[x^k]F_{i}(x)=\s ......
Codeforces Round #885 数学专场
妙,我只能说妙。今天补DEF发现除了F诡秘的杨辉三角,我都能独立做出来。 但为什么我感觉DE难度不如C!!!! ## [A](https://codeforces.com/problemset/problem/1848/A) 题意:一个人站在 $(x,y)$ 处,而其他人分别在 $(x_1,y_1) ......
Codeforces Round #887 Div.2 A-E
# Codeforces Round #887 Div.2 一定要手玩哦 前言: **一定要手玩,一定要手玩!** 我今早一手玩发现C很TM简单,如果赛时我能切C说不定直接上1800.。。。 时隔多年,我的**Codeforces Rating(1718) 再次超越了 @cqbzlhy**(1674 ......
洛谷CF1738C题解
~~好一道博弈论水题~~ [题目传送门](https://www.luogu.com.cn/problem/CF1738C) [更好的食用体验](https://www.luogu.com.cn/blog/878137/cf1738c-ti-xie) ## 题目大意: 给定长度为 $ n $ 的数列 ......
Codeforces Round 887 (Div. 2)记录
A. Desorting 如果有 $a_1 \leq a_2 \leq \ldots \leq a_{n-1} \leq a_n$,则称长度为 $n$ 的数组 $a$ 已排序。 Ntarsis 有一个长度为 $n$的数组 $a$。 他可以对数组进行一种操作(0 次或多次): - 选择一个索引 $i$ ......
Codeforces Round 887(Div 2)(A-C)
# A. Desorting 题目里说的无序是指后面的一个数大于前面一个数,所以只要有一个 a[i+1]-a[i] using namespace std; #define int long long signed main() { ios::sync_with_stdio(false); cin. ......
Codeforces Round 886 (Div. 4)
# [Dashboard - Codeforces Round 886 (Div. 4) - Codeforces](https://codeforces.com/contest/1850) ## [A. To My Critics](https://codeforces.com/contest/1 ......
CF506E Mr. Kitayuta's Gift 思考--zhengjun
妙妙题。 首先可以有一个 $O(kn^2)$ 的 dp,但是显然不行。 但是,发现其中的大多数转移都浪费在自环上了,所以考虑不要这个东西。 这个 dp 一共有三种转移: 1. 左右端点一起向内移动一格; 2. 左端点或右端点单独移动; 3. 左右端点都不动。 所以考虑加一维 $k$ 表示走了 $k$ ......
Educational Codeforces Round 71
# A. There Are Two Types Of Burgers ```cpp #include using namespace std; #define int long long void solve() { int b, p, f, h, c; cin >> b >> p >> f>> ......
Solution to CF1840D Wooden Toy Festival
### Statement $T$ 组评测,每组数据给定长度 $n$ 与长度为 $n$ 的序列 $a$,你需要选三个数 $x,y,z$,输出可得到的最小的 $\max\{\min\{|a_i-x|,|a_i-y|,|a_i-z|\}\}$。 ### Solution 如果只要我们选一个数,显然我们要 ......
Solution to CF1840E Character Blocking
### Statement 给你两个字符串。 操作有: * 忽视两个字符串的同一位置一段时间。 * 交换某两个未被忽视的字符(可以跨越字符串)。 * 查询字符串未被忽视的部分是否相等。 ### Solution 考虑字符串哈希。 对每个字符设置一个 hash 值 $\mathrm{ref}$,对每个 ......
Codeforces Round 887 (Div. 1) 题解
https://codeforces.com/contest/1852/problems # A. Ntarsis' Set https://codeforces.com/contest/1852/problem/A 感觉不是很一眼。 $n$ 和 $k$ 都是 $2 \times 10^5$,~~不 ......
CF852H Bob and stages
pb 讲课题,还是有点坑的。 考虑到 $n$ 和 $k$ 都很小,可以先将所有点对于 $x,y$ 坐标排序,枚举答案凸包最左边那个点 $p$。然后设 $f_{i,j}$ 表示走了 $i$ 步,目前位于 $j$ 点的最大面积,答案就是 $f_{k,p}$。 考虑从 $f_{i-1,x}$ 转移到 $f ......
题解 CF1517G 【Starry Night Camping】
posted on 2022-10-08 22:03:07 | under 题解 | [source](https://www.luogu.com.cn/blog/_post/488890) 神仙 min-cut,果然,flow 题的难点是想到 flow,非 flow 题的难点是不要想到 flow。 ......
CodeForces 1810G The Maximum Prefix
[洛谷传送门](https://www.luogu.com.cn/problem/CF1810G "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1810/G "CF 传送门") 感觉是比较 educational 的题。 拿到 ......
SPOJ 2878 KNIGHTS - Knights of the Round Table
## [SPOJ 2878 KNIGHTS - Knights of the Round Table](https://www.spoj.com/problems/KNIGHTS/) > **注**:本题大多数网上题解是写的洛谷的链接,但洛谷现在无法做判题操作,提示`Unkwon Error`,只好 ......
「题解」Codeforces Round 887 (Div. 2)
## A. Desorting ### Problem [题目](https://codeforces.com/problemset/problem/1853/A) ### Sol & Code 若序列一开始无序答案为 $0$ 若有序即 $a_1\leq a_2 \leq \dots \leq a_ ......
Codeforces Round 887 (Div. 2)
## C. Ntarsis' Set >  > >($1 \leq n,k \leq 2 ......
CF452F. Permutation
很有趣的一道题。双倍经验:[P2757 [国家集训队] 等差子序列](https://www.luogu.com.cn/problem/P2757) 要找三个数构成等差序列,一个直接的想法就是枚举中间的数 $a_i$,然后看它左右两边是不是有 $a_i-k$ 和 $a_i+k$。这个枚举的过程已经不 ......
Codeforces Round 887 (Div 2) C. Ntarsis' Set
Ntarsis' Set 题意是给你n个数,每次按照顺序删除位于a[i]位置的这n个数,问k次后最小的是多少 参考这位大佬的题解Codeforces Round 887 (Div 2)A~C - 知乎 (zhihu.com) 结合一个官方题解,进行一次操作后,由于前面删掉i个数,a[i]到a[i+1 ......
【题解】Educational Codeforces Round 151(CF1845)
VP战报:1h 过了 A,B,C,D 然后被 E 罚坐 1h rank:210th 题解只有 A-E ## A.Forbidden Integer ### 题目描述: 你需要构造一个正整数序列,满足: 1. 对于 $i$,$a_i\le k$ 且 $a_i\not=x$。 2. $\sum a_i= ......
#线性筛,哈希#CF1225D Power Products
# 题目 给定一个长度为 $n$ 的正整数序列 $a$,问有多少对 $(i,j),i #include #include using namespace std; typedef unsigned long long ull; const int N=100011; mapuk; int v[N], ......
牛客周赛Round4(java)
Java组代码 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner =new Scanner(System.in); int n=scanner. ......
Codeforces Round 886 (Div. 4) 题解 A - H
## [A](https://codeforces.com/contest/1850/problem/A). To My Critics ### 题目大意 给定三个数,你可以挑俩数加起来,问这仨数有没有可能加起来大于等于 $10$ . ### 解题思路 我们找其中最大的两个数相加与 $10$ 比较即 ......
nodejs sqlite报错 typeorm[ Expression tree is too large (maximum depth 1000)]
最近在给公司开发一个工具时,使用SQLite,然后突然发现报错: ```js (node:16195) UnhandledPromiseRejectionWarning: QueryFailedError: SQLITE_ERROR: Expression tree is too large (ma ......
Codeforces Round 886 (Div. 4) 全题题解
我关注的人中正式参与**比赛排名公示**: | # | Who | = | Penalty | * | [A](https://codeforces.com/contest/1850/problem/A) | [B](https://codeforces.com/contest/1850/probl ......
Codeforces Round 886 (Div. 4)记录
A - To My Critics 代码: #include<cstdio> #include<algorithm> #include<cmath> #include<vector> #include<string.h> #include<set> #include<string> #include ......