poj 2155】的更多相关文章

POJ 2155  D区段树 思考:D区段树是每个节点设置一个段树树. 刚開始由于题目是求A[I,J],然后在y查询那直接ans^=Map[i][j]的时候没看懂.后面自己把图画出来了才理解. 由于仅仅有0和1.所以能够用异或来搞,而不须要每次都须要改动. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<map> #include…
题目链接[http://poj.org/problem?id=2155] /* poj 2155 Matrix 题意:矩阵加减,单点求和 二维线段树,矩阵加减,单点求和. */ using namespace std; const int INF = 0x3f3f3f3f; ; int N, Q; struct Nodey { int l, r; int val; }; int locx[MAXN], locy[MAXN]; struct Nodex { int l, r; Nodey sty[…
http://poj.org/problem?id=2155 Matrix Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 18143   Accepted: 6813 Description Given an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. I…
线段树套线段树模板题 链接:http://poj.org/problem?id=2155 题解: 代码: #include <bits/stdc++.h> using namespace std; int n,m,k; char c; #define maxn 1111 #define mid (p[x].h+p[x].t)/2 struct xds { int h,t; struct re { int h,t,x,rev; }p[maxn*]; void down(int x) { if (…
题目链接:http://poj.org/problem?id=2155 Matrix Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 32950   Accepted: 11943 Description Given an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th col…
[题目链接] http://poj.org/problem?id=2155 [题目大意] 要求维护两个操作,矩阵翻转和单点查询 [题解] 树状数组可以处理前缀和问题,前缀之间进行容斥即可得到答案. [代码] #include <cstring> #include <cstdio> const int N=1010; using namespace std; int c[N][N],n,m,T; char op[2]; void add(int x,int y){ int i,j,k…
附一篇经典翻译,学习 树状数组  http://www.hawstein.com/posts/binary-indexed-trees.html /** * @author johnsondu * @time 2015-8-22 * @type 2D Binary Index Tree * @strategy 如果翻转的是(x1,y1), (x2,y2)区域.则相当于 * 翻转(0, 0)~(x2, y2), 然后再翻转(0,0)~(x1-1, y2) * (0, 0)~(x2, y1-1),…
二维树状数组....                          Matrix Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 15575   Accepted: 5854 Description Given an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th colu…
Matrix Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 17880   Accepted: 6709 Description Given an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1…
Matrix Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 17226   Accepted: 6461 Description Given an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1…