hiho week 172 register

Ended

Participants:329

Verdict:Accepted
Score:100 / 100
Submitted:2017-10-17 15:21:38

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cstdio>
int n, m, x1, y1, x2, y2, val;
int BIT[1005][1005];
const int mod = 1e9 + 7;
int lowbit(int i) {
    return i & (-i);
}
void add_(int x, int y, int val) {
    for (int i = x; i <= n; i += lowbit(i)) {
        for (int j = y; j <= n; j += lowbit(j)) {
            BIT[i][j] = (BIT[i][j] + val) % mod;
        }
    }
}
int sum_(int x, int y) {
    int res = 0;
    for (int i = x; i > 0 ; i -= lowbit(i)) {
        for (int j = y; j > 0; j -= lowbit(j)) {
            res += BIT[i][j];
            res %= mod;
        }
    }
    return res;
}
int main(void) {
    scanf("%d%d", &n, &m);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX