hiho week 21 register

Ended

Participants:248

Verdict:Accepted
Score:100 / 100
Submitted:2014-11-23 18:04:24

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>
#include <cstring>
#include <algorithm>
using namespace std;
struct seg {
    int l, r, v;
    seg *ls, *rs;
};
const int maxn = 300009;
int n, m, t[maxn], *r[maxn], x[maxn], y[maxn], a[maxn], yy[maxn];
seg *rt, *sp;
inline bool cmpP(int* a, int* b) {
    return *a < *b;
}
#define mid(p) ((p->l+p->r)>>1)
inline seg *sgtBuild(int l, int r) {
    seg *p = sp ++;
    p-> l = l;
    p-> r = r;
    p-> v = 0;
    if (l + 1 < r) {
        p-> ls = sgtBuild(l, mid(p));
        p-> rs = sgtBuild(mid(p), r);
    }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX