E. Vus the Cossack and a Field (求一有规律矩形区域值) 题意:给出一个原01矩阵,它按照以下规则拓展:向右和下拓展一个相同大小的 0 1 分别和原矩阵对应位置相反的矩阵,向右下拓展一个和原矩阵相同的矩阵,可以无限拓展,现给出Q个查询 问以 x1,y1,x2,y2为矩阵左上角和右下角的矩形中共有多少个一 reference : https://blog.csdn.net/code92007/article/details/94149487 https://orzsi…
题目描述: 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…
Description 给出一个$n\times m$的$01$矩阵$A$. 记矩阵$X$每一个元素取反以后的矩阵为$X'$,(每一个cell 都01倒置) 定义对$n \times m$的矩阵$A$进行一次变幻操作,变幻后矩阵的大小是$2n \times 2m$的. 具体来说,我们会把$A$复制一份到$A$的右下方,计算$A'$并放置在$A$的正右方和正下方. 设连续操作$n$的结果是$f^n(A)$ 即 $f^n(A) = \left\{\begin{matrix} f(f^{n-1}(A)…
题目链接: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:暑假第一天,签到写个稍微简单一点的题…
题意:给你一张无向图,要求对这张图进行删边操作,要求删边之后的图的总边数 >= 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,…
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…
传送门:QAQQAQ 题意:给一个01矩阵A,他的相反矩阵为B,每一次变换都会将原矩阵面积乘4成为: AB BA 矩阵的左上角固定,变换无限次,现有q个询问,即求一个矩阵内的1的个数. 思路:因为反转,所以A,B矩阵拼起来刚好是一个全都为1的矩阵,所以答案就是匹配的A,B矩阵总点数/2和右下角1的个数之和 注意点: 1.因为数据较大,要用前缀和思想 2.要开longlong 3.注意询问时各个变量的重置 代码: #include<iostream> #include<cstdio>…