CF869 E. The Untended Antiquity
来源:互联网 发布:消息队列java 编辑:程序博客网 时间:2024/05/20 02:27
orz:ozy
code:
#include<cstdio>#include<cstdlib>#include<cstring>#include<iostream>#include<map>#include<algorithm>#define LL long longusing namespace std;const LL mod=10037;LL tr[2510][2510];map<pair<pair<int,int>,pair<int,int> >,LL > g;LL n,m,p;LL lowbit(LL x){return x&(-x);}void change(LL x,LL y,LL k){ for(LL i=x;i<=n;i+=lowbit(i)) for(LL j=y;j<=m;j+=lowbit(j)) tr[i][j]+=k;}LL get(LL x,LL y){ LL ans=0; for(LL i=x;i>=1;i-=lowbit(i)) for(LL j=y;j>=1;j-=lowbit(j)) ans+=tr[i][j]; return ans;}int main(){ memset(tr,0,sizeof(tr)); scanf("%lld%lld%lld",&n,&m,&p); LL s=1; for (LL u=1;u<=p;u++) { LL op,x1,y1,x2,y2; scanf("%lld %lld %lld %lld %lld",&op,&x1,&y1,&x2,&y2); if (op==1) { s=s*mod; g[make_pair(make_pair(x1,y1),make_pair(x2,y2))]=s; change(x1,y1,s); change(x1,y2+1,-s); change(x2+1,y1,-s); change(x2+1,y2+1,s); } if (op==2) { LL ooo=g[make_pair(make_pair(x1,y1),make_pair(x2,y2))]; change(x1,y1,-ooo); change(x1,y2+1,ooo); change(x2+1,y1,ooo); change(x2+1,y2+1,-ooo); } if (op==3) { LL aa=get(x1,y1),bb=get(x2,y2); if (aa==bb) printf("Yes\n"); else printf("No\n"); } } return 0;}
阅读全文
0 0
- CF869 E. The Untended Antiquity
- CF869 E. The Untended Antiquity
- CF #439 E The Untended Antiquity
- Codeforces869E The Untended Antiquity
- Codeforces Round #439 E. The Untended Antiquity (树状数组+随机化)
- Codeforces Round #439 (Div. 2) E. The Untended Antiquity
- Codeforces 869 E. The Untended Antiquity 二维树状数组
- codeforces 869E The Untended Antiquity 二维BIT + hash
- CF 869E(The Untended Antiquity-Hash值维护连通性)
- Codeforces Round #439 (Div. 2) E. The Untended Antiquity
- [哈希+差分] Codeforces 869E. The Untended Antiquity
- codeforces—— 869E —— The Untended Antiquity
- Codeforces Round #439 (Div. 2) E:The Untended Antiquity(Hash+二维树状数组)
- Codeforces Round #439 (Div. 2) E. The Untended Antiquity (hash+数状数组)
- Codeforces Round #439 (Div. 2) E. The Untended Antiquity(二维BIT)
- Codeforces Round #439 (Div. 2) E. The Untended Antiquity 二维线段树||二维树状数组
- Codeforces Round #439 (Div. 2) E. The Untended Antiquity 二维树状数组 随机化
- Codeforces Round #439 (Div. 2) E. The Untended Antiquity(Hash)
- Codeforces Round #439 (Div. 2) C
- hash
- MPEG-CDVA标准的特征提取(除深度学习)& 视频匹配 & 视频检索
- 50. Pow(x, n)
- 将链表L就地逆置,即利用原表各结点的空间实现逆置
- CF869 E. The Untended Antiquity
- 【Java学习3.5.2】强制类型转换
- k组合生成问题-非递归
- Mapper动态代理方式
- OpenCV3 python语言实现(1)
- 吉普赛人利用买家的无知兜售伪造的实体比特币(Gypsies Peddling Fake Physical Bitcoins)
- 深度学习工具汇总
- PHPWAMP配置应该如何修改,Web服务器、php、mysql的具体配置修改
- Deep Deterministic Policy Gradient(DDPG)