poj 2029 树状数组
来源:互联网 发布:软件版权声明 编辑:程序博客网 时间:2024/05/20 12:49
#include<cstdio>#include<cstring>#define MAX_N 120#define MAX(x,y) ((x)>(y)?(x):(y))int bit[MAX_N][MAX_N];int n,m;void add(int i,int j){for(int k=i;k<=n;k+=k&-k)for(int p=j;p<=m;p+=p&-p)bit[k][p]+=1;}int sum(int i,int j){int res=0;for(int k=i;k>0;k-=k&-k)for(int p=j;p>0;p-=p&-p)res+=bit[k][p];return res;}int main(){int q,res,i,j;while(~scanf("%d",&q)&&q){res=0;int a,b,s,t;memset(bit,0,sizeof(bit));scanf("%d%d",&n,&m);for( i=0;i<q;i++){scanf("%d%d",&a,&b);add(a,b);}scanf("%d%d",&s,&t);for( i=1;i<=n-s+1;i++)for( j=1;j<=m-t+1;j++){res=MAX(res,sum(i+s-1,j+t-1)-sum(i+s-1,j-1)-sum(i-1,j+t-1)+sum(i-1,j-1));}printf("%d\n",res);}}
0 0
- poj 2029 树状数组
- POj 2029 (二维树状数组)
- poj 2029(树状数组)
- poj 2029(二维树状数组)
- poj 2029 二维树状数组入门
- POJ 2352 树状数组
- Poj 树状数组
- poj 1990【树状数组】
- poj 2352 树状数组
- poj 2481 树状数组
- poj 3067 树状数组
- POJ 2481 树状数组
- POJ 3067 树状数组
- POJ 2352 树状数组
- poj 2352(树状数组)
- POJ 2481 树状数组
- poj 2828 树状数组
- POJ 3928 - 树状数组
- JSON和GSON学习
- Bean named 'transactionAdvice' must be of type [org.aopalliance.aop.Advice], but was actually of typ
- bmon:Linux 下一个强大的网络带宽监视和调试工具
- 前端工程师之HTML基础知识1
- Java中的Listener监听器
- poj 2029 树状数组
- abstract class和interface的区别
- 免费馅饼(注释加解析)
- MySQL多表操作
- [杂题] Codeforces 627F 8VC Venture Cup 2016
- oracle5
- 欢迎使用CSDN-markdown编辑器
- 关键字: 抽象类与接口的区别
- 面试题总结(一)