func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 400 * 1000 + 10;   vector<int> graph[N];   int n, num[N], par[N], ans[N], c1[N], c2[N];   void dfs(int v) {     num[v]++;     for (int i = 0; i < (int)graph[v].size(); i++) {       int u = graph[v][i];       if (u != par[v]) {         par[u] = v;         dfs(u);         num[v] += num[u];         if (num[u] - c1[u] > n / 2) ans[v] = 1;         c1[v] = max(c1[v], c1[u]);       }     }     if (num[v] <= n / 2) c1[v] = num[v];   }   void dfs2(int v) {     if (n - num[v] - c2[v] > n / 2) ans[v] = 1;     if (n - num[v] <= n / 2) c2[v] = n - num[v];     int mx = c2[v];     for (int i = 0; i < (int)graph[v].size(); i++) {       int u = graph[v][i];       if (u != par[v]) {         c2[u] = max(c2[u], mx);         mx = max(mx, c1[u]);       }     }     mx = 0;     for (int i = (int)graph[v].size() - 1; i >= 0; i--) {       int u = graph[v][i];       if (u != par[v]) {         c2[u] = max(c2[u], mx);         mx = max(mx, c1[u]);         dfs2(u);       }     }   }   int main() {     cin >> n;     for (int i = 0; i < n - 1; i++) {       int a, b;       cin >> a >> b;       a--;       b--;       graph[a].push_back(b);       graph[b].push_back(a);     }     par[0] = -1;     dfs(0);     dfs2(0);     for (int i = 0; i < n; i++) cout << 1 - ans[i] <<    ;     cout << endl;     return 0;   }   