rounding maximum 1857b cf
【题解】CF gym 104337 G. Guess the Polynomial
statement:https://codeforces.com/gym/104337/problem/G 。 即求 $f(x)=\sum\limits_{i=0}^{p-2}a_ix^i$,其中只有不超过 $n$ 个 $a_i$ 非 $0$ 。 记: $$ \begin{aligned} A_{n ......
Codeforces Round 871 (Div. 4) ABCDEF
> 很久没写题目了,划点水题 ###A. Love Story ``` #include using namespace std; typedef long long LL; typedef pair PII; const LL MAXN = 1e18; const LL N = 1e6, M = ......
CF1450C2 题解
[题目传送门](https://www.luogu.com.cn/problem/CF1450C2) 再不写题解社贡要掉到 $0$ 了。 ## 题目分析 显然如果 $3$ 个格子构成了满足获胜条件的情况,这 $3$ 个格子模 $3$ 的余数各不相同。 那么我们将格子按模 $3$ 的余数分为 $3$ ......
「解题报告」Codeforces Round #884 (Div. 1 + Div. 2) Editorial
比赛地址:[Dashboard - Codeforces Round 884 (Div. 1 + Div. 2) - Codeforces](https://codeforces.com/contest/1844) 个人评价:这场是**构造**专场! ## A. Subtraction Game [ ......
CF1360H Binary Median 题解
提供一份好看的题解。 $2^m-n$ 个数的中位数排名是 $\lfloor\dfrac{2^m-n-1}2\rfloor$(从 $0$ 开始)。因为所有元素是连续的,只要数出被删掉的比中位数小的元素数量,那么 $\lfloor\dfrac{2^m-n-1}2\rfloor$ 加上数量就是中位数了。 ......
django python manage.py migrate 后报错字段长度超了 django.db.utils.OperationalError: (1118 'Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535.
现象: 在models.py 将CharField字段的maxlength=修改后,执行ython manage.py migrate 报错django.db.utils.OperationalError: (1118 'Row size too large. The maximum row siz ......
Codeforces Round #771 (Div. 2) A-E
# A ## 代码 ```c++ #include using namespace std; using ll = long long; int p[507]; bool solve() { int n; cin >> n; for (int i = 1;i > p[i]; int pos1 = 0 ......
CF865D Buy Low Sell High
# CF865D Buy Low Sell High 我发现自己是真的学不会贪心……太玄学了。 这是一道反悔贪心的题目,比较简单的那种。 ## 题意 你是一棵韭菜,喜欢炒股,每天可以买入一股或卖出一股,且最后一天之后你持有的股票数目应该为 $0$。你现在知道 $n$ 天的股票价格,求最大获利。 ## ......
CF1814D Balancing Weapons
[CF1814D Balancing Weapons](https://www.luogu.com.cn/problem/CF1814D) 原题明显可以转化为: 给定一个长度为 $n$ 的数组,初始为 $p_i$。可以调整元素的值,但第 $i$ 个元素必须是 $a_i$ 的 **整数** 倍,并且 ......
SMU Summer 2023 Contest Round 2
# [SMU Summer 2023 Contest Round 2](https://codeforces.com/group/L9GOcnr1dm/contest/450889) ## [A. Treasure Hunt](https://codeforces.com/group/L9GOcnr ......
Educational Codeforces Round 23
# A. Treasure Hunt ```cpp #include using namespace std; int read() { int x = 0, f = 1, ch = getchar(); while ((ch '9') && ch != '-') ch = getchar(); i ......
Codeforces Round 883 (Div. 3)
# Codeforces Round 883 (Div. 3) 题目链接:[Codeforces Round 883 (Div. 3)](https://codeforces.com/contest/1846 "Codeforces Round 883 (Div. 3)") ## A. Rudolp ......
CF420E Playing the ball
## Description 程序员不能总是整天坐着编程。有时站起来离开办公桌,休息一下,与同事闲聊,甚至玩一会,也是十分好的主意。F 公司的程序员就特别喜欢一种球类游戏。 让我们想象一个在笛卡尔坐标系平面上玩的游戏。玩家坐落在点 $(0,0)$ 上,选择任意一个方向,扔出球。飞了一会儿的球在距离原 ......
CF878E 题解
# CF878E Numbers on the blackboard 题解 ## Links [洛谷](https://www.luogu.com.cn/problem/CF878E) [Codeforces](https://codeforces.com/problemset/problem/87 ......
Educational Codeforces Round 96 (Rated for Div. 2)E
You are given a string s. You have to reverse it — that is, the first letter should become equal to the last letter before the reversal, the second le ......
CF407E k-d-sequence
## Description 我们称一个数列为一个好的 $k-d$ 数列,当且仅当我们在其中加上最多 $k$ 个数之后,数列排序后为一个公差为 $d$ 的等差数列。 你手上有一个由 $n$ 个整数组成的数列 $a$。你的任务是找到它的最长连续子串,使得满足子串为好的 $k-d$ 数列。 ## Sol ......
Luogu CF633B 【A Trivial Problem】题解
一段理解起来特别容易的代码 (目前来看是最短的) ## 思路 由于末尾0的个数就是阶乘中分解出10的个数,也就是分解出2的个数与5的个数中的最小值; 显然5的个数小于2的个数,即找出分解出的5的个数。 **比较容易推出:当 $n$ 为 $5^{k}$ 的倍数时,其阶乘分解出 $5$ 的个数即为 $n ......
CF603E Pastoral Oddities
题目条件的充要条件是原图每个连通块点数都是偶数。 - 必要性:若为奇数,则总度数为奇数*奇数,还是奇数,但是每条边贡献两个度,总度数一定是偶数。矛盾。 - 充分性:对于一个偶数个点的连通块,我们一定能找到合法的边集,构造方式如下: > 随便抠出一颗生成树,随便定个根,从叶子开始向上重复这个流程:若该 ......
SMU Summer 2023 Contest Round 1
# [SMU Summer 2023 Contest Round 1](https://codeforces.com/group/L9GOcnr1dm/contest/450888) ## [A. The Contest](https://codeforces.com/group/L9GOcnr1d ......
Educational Codeforces Round 29
# Educational Codeforces Round 29 https://codeforces.com/contest/863 复健训练 太久没练直接变身傻逼(难道原来就不是吗,笑) ## A. Quasi-palindrome 直接去除后缀0即可(WA了两发评价为弱智) ```CC #i ......
牛客周赛 Round 2 A~D
A #include <iostream> #include <cstring> #include <string> #include <algorithm> #include <cmath> #include <set> #include <utility> #include <vector> # ......
【计数,DP】CF1081G Mergesort Strikes Back
[Problem Link](https://codeforces.com/contest/1081/problem/G) 现有一归并排序算法,但是算法很天才,设了个递归深度上限,如果递归深度到达 $k$ 则立即返回。其它部分都和正常归并排序一样,递归中点是 $\lfloor (l+r)/2 \rf ......
CF1585F Non-equal Neighbours - 容斥 - dp - 单调栈
题目链接:https://codeforces.com/problemset/problem/1585/F 题解: 难难难 考虑容斥:设 $A_i$ 表示 $b_i \neq b_{i+1}$ ($i=1,2,\cdots,n-1$) 时对应的 $\{b_i\}$ 方案的答案 那么答案就是 $$\b ......
CF1421E题解
title: CF1421E题解 date: 2023-05-25 21:06:45 tags: 题解 cover: https://img.paulzzh.com/touhou/konachan/image/5558d2c6085f80d3cfeade810d7aa417.jpg [题目链接](h ......
CF1545D-题解
title: CF1545D 题解 date: 2023-06-05 19:36:13 tags: 题解 cover: https://img.paulzzh.com/touhou/konachan/image/bdf79fcf8026aae582a32911c942c8b0.jpg [题目链接]( ......
Maximum Sum
Maximum Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an array a1,a2 ......
CF1827D 题解
[problem](https://www.luogu.com.cn/problem/CF1827D) & [blog](https://www.cnblogs.com/liangbowen/p/17541713.html)。 很好的题。用到一些关于重心的 trick。 不妨认为只有一个重心 $\t ......
Educational Codeforces Round 22
# A. The Contest 想一想就知道,提交的时间无所谓,所以我们选择全部做完后的第一个时间间隔提交即可 ```cpp #include using namespace std; #define int long long int read() { int x = 0, f = 1, ch ......
[CF407E] k-d-sequence
# [CF407E] k-d-sequence 复健不会写代码。 首先找充要条件,如一个子串 $a_l,a_{l+1}...a_r$ 合法,则首先这些数互不重复,其次这些数对 $d$ 取模相同,最重要的是 $$ \dfrac{\max{a} - \min{a}}{d} - (r - l) \le k ......
CF1034D 题解
## CF1034D 总评:非常牛逼的 $3500$。 求第 $k$ 大的价值可以二分一个 $m$,变成求价值 $\ge m$ 的区间**个数**,设其为 $C(m)$。求出第 $k$ 大价值 $M$ 后,本题求前 $k$ 大的价值和,这便要求我们求价值 $\ge m$ 的区间**价值和** ......