题意:给你一张无向图,要求对这张图进行删边操作,要求删边之后的图的总边数 >= ceil((n + m) / 2), 每个点的度数 >= ceil(deg[i] / 2).(deg[i]是原图中i的度数) 思路1:模拟 + 乱搞 直接暴力删就行了,读入边之后随机打乱一下就很难被hack了. 代码: #include <bits/stdc++.h> #define LL long long #define INF 0x3f3f3f3f #define db double #defin…
目录 @description@ @solution@ @accepted code@ @details@ @description@ 给定一个 n 点 m 边的图(n, m<=10^6),记第 i 个点的度数为 di. 现让你保留不超过 (n + m) / 2(向上取整)条边,并且要求新图中第 i 个点的度数 di' 满足 2di' ≥ di. 不难证明它一定有解.现你只需要输出任意一种方案. input 第一行包含 n 和 m,表示点数与边数. 接下来 m 行每一行包含 2 个整数 ui,…
题目描述: D. Vus the Cossack and Numbers Vus the Cossack has nn real numbers aiai. It is known that the sum of all numbers is equal to 00. He wants to choose a sequence bb the size of which is nn such that the sum of all numbers is 00 and each bibi is ei…
题目链接:https://codeforc.es/contest/1186/problem/C 题目大意:xxxxx(自认为讲不清.for instance) 例如:a="01100010" b="00110". 我们把a截到b的长度就有4个字串. a1=01100 a2=11000 a3=10001 a4=00010 f(s1,s2)表示是s1与s2异或后1的个数 题目要求每个a子串与b的f(ai,b)的值为偶数的个数. ps:暑假第一天,签到写个稍微简单一点的题…
题目链接: C. Bear and Forgotten Tree 3 time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A tree is a connected undirected graph consisting of n vertices and n  -  1 edges. Vertices are numbered …
Codeforces 题目传送门 & 洛谷题目传送门 蠢蠢的我竟然第一眼想套通项公式?然鹅显然 \(5\) 在 \(\bmod 10^{13}\) 意义下并没有二次剩余--我真是活回去了... 考虑打表找规律(u1s1 这是一个非常有用的技巧,因为这个 \(10^{13}\) 给的就很灵性,用到类似的技巧的题目还有这个,通过对这些模数的循环节打表找出它们的共同性质,所以以后看到什么特殊的数据或者数据范围特别大但读入量 \(\mathcal O(1)\) 的题(比如 CF838D)可以考虑小数据打…
题意: 给你一个长度为 nnn 的 010101串 ,你有两种操作: 1.将一个子串翻转,花费 XXX 2.将一个子串中的0变成1,1变成0,花费 YYY 求你将这个01串变成全是1的串的最少花费. 首先,我们可以将串按照0,10,10,1这划分,例如: «00011001110»−>«000»+«11»+«00»+«111»+«0»«00011001110» -> «000» + «11» + «00» + «111» + «0»«00011001110»−>«000»+«11»+«0…
Vus the Cossack has two binary strings, that is, strings that consist only of "0" and "1". We call these strings aa and bb. It is known that |b|≤|a||b|≤|a|, that is, the length of bb is at most the length of aa. The Cossack considers e…
C. Vus the Cossack and Strings Vus the Cossack has two binary strings, that is, strings that consist only of "0" and "1". We call these strings aa and bb. It is known that |b|≤|a||b|≤|a|, that is, the length of bb is at most the length…
Vus the Cossack has nn real numbers aiai. It is known that the sum of all numbers is equal to 00. He wants to choose a sequence bb the size of which is nn such that the sum of all numbers is 00 and each bibi is either ⌊ai⌋⌊ai⌋ or ⌈ai⌉⌈ai⌉. In other w…