Codeforces 869E The Untended Antiquity】的更多相关文章

Codeforces 869E. The Untended Antiquity 题意: 在一张mxn的格子纸上,进行q次操作: 1,指定一个矩形将它用栅栏围起来. 2,撤掉一个已有的栅栏. 3,询问指定两点之间是否连通(即能否从其中一点不翻越栅栏走到另一点) 思路: 对于操作1,将给定的矩形哈希成一个数(可对点坐标进行进制哈希),对整个矩形所覆盖的点都累加上这个数: 对于操作2,则逆着把操作1的影响抵消掉: 对于操作3,看一下两点的值是否相同(相同表示他们被相同的矩形们所覆盖). 至于每次矩形内…
题意:给定一个网格图,三种操作:1.在(r1,c1,r2,c2)处建围墙.2.删除(r1,c1,r2,c2)处的围墙.3.询问两点是否可达 思路比较巧妙,将围墙内的点赋加一个权值,询问的时候判断两个点的权是否相等即可.显然可以用二维树状数组实现. #include<bits/stdc++.h> using namespace std; #define MAXN 2500+10 typedef long long LL; ; LL sum[MAXN][MAXN],n,m,q; int lowbi…
E. The Untended Antiquity 题目链接http://codeforces.com/contest/869/problem/E 解题心得: 1.1,x1,y1,x2,y2 以(x1,y1)为左上角(x2,y2)为右下角的矩形,四边建墙.      2,x1,y1,x2,y2 以(x1,y1)为左上角(x2,y2)为右下角的矩形,拆除墙(肯定存在).      3,x1,y1,x2,y2问是否可以从(x1,y1)走到(x2,y2)(没墙阻隔). 2.先要标记每个点的状态,将用墙…
Adieu l'ami. Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around the abandoned Eikou Cram School building, Oshino's makeshift residence. The space is represented by a rectangular grid of n × m cells, arranged into n…
CF869E The Untended Antiquity 题目描述 \(\text{Adieu l'ami}\). Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around the abandoned Eikou Cram School building, Oshino's makeshift residence. The space is represented by a re…
题目链接:http://codeforces.com/contest/869/problem/E 题解:这题是挺好想到solution的但是不太好写,由于题目的特殊要求每个矩形不会重贴所以只要这两个点最内抱着他们的是同一个矩形就行了.就是最近抱汉她们的矩形是同一个就行了.有一种方法挺好的主要是数据是大多数随机的,所以可以考虑hash一下rand一下每个点的赋值然后求前缀和相同就是满足条件的,这里可以用一下2维德树状数组做一下.seed尽量大点这样失败的概率也就小点官方题解有详细的概率数据可以参考…
time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Adieu l'ami. Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around the abandoned Eikou Cram School building…
Magic Door 题目大意 有一个n*m的网格,支持三中操作: 1.在x1,y1,x2,y2为顶点的矩形周围围上栅栏 2.将x1,y1,x2,y2为顶点的矩形周围的栅栏拆掉 3.询问x1,y1,x2,y2两点是否联通 保证栅栏矩形不相交 题目分析 因为栅栏的矩形互不相交,所以两点不连通时一定在不同的地域里. 因此可以将栅栏附上一个hash值,用二维树状数组维护前缀和,如果点查到的值相同则代表在同一个地域里. code #include<bits/stdc++.h> using namesp…
Codeforces Round #439 (Div. 2) codeforces 869 A. The Artful Expedient 看不透( #include<cstdio> int main(){ puts("Karen"); ; } 15ms codeforces 869B. The Eternal Immortality(数学,水) 题意:输出两个数的阶乘的商的 个位数 题解:两数之差大于5,个位数就是0.小于5直接个位相乘即可. #include<cs…
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题.. 今天,我们来扒一下cf的题面! PS:本代码不是我原创 1. 必要的分析 1.1 页面的获取 一般情况CF的每一个 contest 是这样的: 对应的URL是:http://codeforces.com/contest/xxx 还有一个Complete problemset页面,它是这样的:…