• POJ 2155 Matrix


    #include<iostream>
    #include<cstdio>
    #include<cmath>
    #include<cstring>
    #include<sstream>
    #include<algorithm>
    #include<queue>
    #include<deque>
    #include<iomanip>
    #include<vector>
    #include<cmath>
    #include<map>
    #include<stack>
    #include<set>
    #include<fstream>
    #include<memory>
    #include<list>
    #include<string>
    using namespace std;
    typedef long long LL;
    typedef unsigned long long ULL;
    #define MAXN 1000 + 23
    #define L 31
    #define INF 1000000009
    #define eps 0.00000001
    #define sf(a) scanf("%d",&a)
    int T, n, k;
    int a[MAXN][MAXN];
    char op[2];
    inline int lowbit(int x)
    {
        return x&(-x);
    }
    void update(int x, int y)
    {
        for (int i = x; i < MAXN; i += lowbit(i) )
        {
            for (int j = y; j < MAXN; j += lowbit(j) )
            {
                a[i][j]++;
            }
        }
    }
    
    int query(int x, int y)
    {
        int sum = 0;
        for (int i = x; i > 0; i -= lowbit(i))
        {
            for (int j = y; j > 0; j -= lowbit(j))
            {
                sum += a[i][j];
            }
        }
        return sum;
    }
    int main()
    {
        int x1, y1, x2, y2;
        sf(T);
        while (T--)
        {
            memset(a, 0, sizeof(a));
            sf(n), sf(k);
            for (int i = 0; i < k; i++)
            {
                scanf("%s", op);
                if (op[0] == 'C')
                {
                    sf(x1), sf(y1), sf(x2), sf(y2);
                    x1++, y1++, x2++, y2++;//避免出现0
    
                    update(x1, y1);
                    update(x1, y2 + 1);
                    update(x2 + 1, y1);
                    update(x2 + 1, y2 + 1);//重叠的部分加上 
                }
                else
                {
                    sf(x1), sf(y1);
                    x1++, y1++;
                    printf("%d
    ", query(x1, y1) % 2);
                }
            }
            cout << endl;
        }
    }
  • 相关阅读:
    WEB UI 整理
    RAT
    client 控制
    SiMay 远控
    SSH/SOCKS成为全局代理
    BypassAntiVirus
    QuasarRAT 使用
    从 Qt 的 delete 说开来
    Spectrum Analyzer test.cpp Example File
    windows下C/C++的内存泄露检测
  • 原文地址:https://www.cnblogs.com/joeylee97/p/7468813.html
Copyright © 2020-2023  润新知