hihoCoder太阁最新面经算法竞赛16 register

Ended

Participants:75

Verdict:Accepted
Score:100 / 100
Submitted:2016-11-27 16:55:01

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 <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <functional>
#include <algorithm>
#include <vector>
using namespace std;
struct Node{
    bool leaf;
    bool val;//0 and , 1 or
}data[210];
bool src[210];
bool change[210];
vector<int> vi[210];
const int MMAX = (1 << 28);
int DFS(int p){
    if (data[p].leaf){
        src[p] = data[p].val;
        change[p] = 0;
        return -1;
    }
    int l = vi[p][0];
    int r = vi[p][1];
    int L = DFS(l);
    int R = DFS(r);
    if (data[p].val){//or
        src[p] = src[l] | src[r];
        if (src[l] && src[r]){//11
            int mmin = MMAX;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX