MSBOP 2015 Round3 register

Ended

Participants:978

Verdict:AC | TLE
Submitted:2015-05-09 14:52:08

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 <cstdlib>
#include <cstring>
const int maxn = 200010;
int n, q;
struct Node {
    int l, r, d;
} t[maxn * 20];
int cnt;
int root[maxn];
void ins(int p1, int &p2, int deep, int d)
{
    p2 = ++cnt;
    t[p2] = t[p1];
    ++t[p2].d;
    if (deep < 0) return;
    if ((1 << deep) & d) ins(t[p1].r, t[p2].r, deep - 1, d);
    else ins(t[p1].l, t[p2].l, deep - 1, d);
}
int min(int a, int b) { return (a < b) ? a : b; }
void init()
{
    scanf("%d%d", &n, &q);
    memset(t, 0, sizeof(t));
    root[0] = 0;
    cnt = 0;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX