Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include<bits/stdc++.h>using namespace std;struct node{int n;int t;int res;int c;int s[3];}A[110];int N,root;int res(int x){int i,j,k,l;if(A[x].t<2){A[x].res=A[x].n;A[x].c=-1;return A[x].res;}i=A[x].s[1];j=A[x].s[2];if(A[x].t==2){A[x].res=res(i)&res(j);if(A[x].res==0){if((A[i].res|A[j].res)==1)A[x].c=1;else{if(A[i].c==-1)