MSBOP 2015 Round3 register

Ended

Participants:978

Verdict:AC | TLE
Submitted:2015-05-09 14:51:13

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 <cctype>
#include <cstdio>
#include <algorithm>
using namespace std;
const int N = int(2e5) + 50, inf = int(2e9) + 7;
int axis[N * 2], A[N];
struct query { int l, r, k; } Q[N];
int n, m, p;
struct tree { int cnt; tree *lc, *rc; } TBf[int(8e6)], *TC = TBf, *root[N];
tree* insert (tree *t, int l, int r, int p)
{
    tree *ret = TC++;
    *ret = t ? (tree){t->cnt + 1, t->lc, t->rc} : (tree){1, NULL, NULL};
    if (l == r)
    {
        return ret;
    }
    int m = (l + r) >> 1;
    if (p <= m)
    {
        ret->lc = insert(ret->lc, l, m, p);
    }
    else
    {
        ret->rc = insert(ret->rc, m + 1, r, p);
    }
    return ret;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX