Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
水之!!!#define stop system("pause") #include <cstdio> #include <cstdlib> #include <iostream> #define N 1100 using namespace std; int lowbit(int i){ return (i&(-i)); } int c[N][N],n; void updat(int x,int y,int val){ for (;x<=n;x+=lowbit(x)) for (int i=y;i<=n;i+=lowbit(i)) c[x][i]+=val; } int getsum(int x,int y){ int sum = 0; for( ;x;x-=lowbit(x)) for(int i=y;i;i-=lowbit(i)) sum += c[x][i]; return sum; } int main(){ int ca; cin>>ca;int o=0; while(ca--){ if(o) puts(""); o++; int m; memset(c,0,sizeof(c)); scanf("%d%d",&n,&m); while(m--){ char str[55]; scanf("%s",str); if(str[0]=='C'){ int x1,x2,y1,y2; scanf("%d%d%d%d",&x1,&y1,&x2,&y2); updat(x1, y1, 1); updat(x2 + 1, y2 + 1, -1); updat(x1, y2 + 1, -1); updat(x2 + 1, y1, -1); } else { int a,d; cin>>a>>d; printf("%d\n",getsum(a,d)&1); } } } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator