假设该矩形是aij,那么有a(i,j)=a(i-1,j-1)^a(i-1,j+1)^a(i-2,j),不断递归下去可以发现a(i,j)=a(1,y-x+1)^a(1,y-x+3)^--^a(1,x+y-1). 那么,对第一行处理前缀和,Si=S(i-2)^a(1,i),即给出了两个数S的异或,只需将每一个点裂点为i和i',然后若Si^Sj=0,并查集上连边(i,j)(i',j'),否则连(i,j')(i',j),最后只需判断i和i'是否相连,相连即为0(这个可以理解为i表示i上是1,i'表示i上…
原文链接https://www.cnblogs.com/zhouzhendong/p/CF461D.html 题解 首先我们可以发现如果确定了第一行,那么方案就唯一了. 然后,我们来看看一个点的值确定了会导致什么: 假设我们确定了红色点的值,那么所有包含橙色的格子xor起来就等于红色格子的值,绿色蓝色也是. 第一排就比较特殊了. 如果我们在对第一排奇偶分类之后,如果我们可以得到第一行的前缀xor之间的关系,那么我们就有希望解决这个问题. 再看一种情况: 类似地意思,我们会发现这个东西遇到墙会反射…
http://acm.hdu.edu.cn/showproblem.php?pid=3974 题目大意: 一个公司有N个员工,对于每个员工,如果他们有下属,那么他们下属的下属也是他的下属. 公司会给员工安排任务,分配给一个员工后,他也会把这个任务分配给下属.被分配到任务的人立刻停止 当前在做的工作,接受新的任务. 对于给定的M个操作 C x  输出编号为x的任务 T x y  分配任务y给x 思路: 并查集的实现,分配我们只记录在上司结点里,只不过查询的时候要把它的所有上司全部找一遍. #inc…
Assign the task Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=3974 Description There is a company that has N employees(numbered from 1 to N),every employee in the company has a immediate boss (except for the l…
正题 题目链接:https://www.luogu.com.cn/problem/CF461D 题目大意 \(n*n\)的网格需要填上\(x\)或\(o\),其中有\(k\)个格子已经固定,求有多少中填写方案使得每个格子的四周都有偶数个\(o\). 解题思路 约束条件相当于一个格子周围的异或和都为\(0\),也就是对于任意\((x,y)\)都有\(a_{x-1,y}\ xor\ a_{x,y-1}\ xor\ a_{x+1,y}\ xor\ a_{x,y+1}\).也就是对于一个格子\((x,y…
G - Brain Network (easy) Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u CodeForces 690C1 Description One particularly well-known fact about zombies is that they move and think terribly slowly. While we still don't know…
Junk-Mail Filter Time Limit: 15000/8000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9135    Accepted Submission(s): 2885 Problem Description Recognizing junk mails is a tough task. The method used here consists o…
D. Fools and Foolproof Roads   You must have heard all about the Foolland on your Geography lessons. Specifically, you must know that federal structure of this country has been the same for many centuries. The country consists of n cities, some pairs…
The Accomodation of Students Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4091    Accepted Submission(s): 1876 Problem Description There are a group of students. Some of them may know each ot…
Play on Words Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7791    Accepted Submission(s): 2676 Problem Description Some of the secret doors contain a very interesting word puzzle. The team…