hiho week 149 register

Ended

Participants:261

Verdict:Accepted
Score:100 / 100
Submitted:2017-05-09 00:03:59

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 <vector>
#include <string>
#include <cstring>
#include <iostream>
#define OO 0x0fffffff
#define MIN(a,b) (a<b?a:b)
using namespace std;
struct NODE{
    NODE *left,*right;
    int aid;
    bool accept;
    NODE(){
        aid = -1;
        left = right = NULL;
    }
};
NODE root;
int digits[4];
void add_acl(int id,char *acl,bool accept){
    NODE *ptr = &root;
    for(int i=0;acl[i];i++){
        if(acl[i]=='1') {
            if(ptr->right==NULL) ptr->right = new NODE();
            ptr = ptr->right;
        }
        else{
            if(ptr->left==NULL) ptr->left = new NODE();
            ptr = ptr->left;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX