func_code_string: #include <bits/stdc++.h>   const int MAXN = 2e5 + 7;   struct Edge {     int t, next;   } edge[MAXN << 1];   int head[MAXN], cnt;   std::pair<int, int> p[MAXN];   int color[MAXN];   int n;   void add(int u, int v) {     edge[++cnt] = (Edge){v, head[u]};     head[u] = cnt;   }   void dfs(int u, int col) {     if (color[u] != -1) return;     color[u] = col;     for (int e = head[u]; e; e = edge[e].next) {       int v = edge[e].t;       dfs(v, col ^ 1);     }   }   int main(int argc, char *argv[]) {     memset(color, -1, sizeof color);     scanf( %d , &n);     int l, r;     for (int i = 0; i < n; i++) {       scanf( %d %d , &l, &r);       add(i << 1, i << 1 | 1);       add(i << 1 | 1, i << 1);       p[i << 1] = std::make_pair(l, i << 1);       p[i << 1 | 1] = std::make_pair(r + 1, i << 1 | 1);     }     std::sort(p, p + 2 * n);     for (int i = 0; i < n; i++) {       int u = p[i << 1].second, v = p[i << 1 | 1].second;       add(u, v), add(v, u);     }     for (int i = 0; i < n; i++) {       if (color[i << 1] == -1) dfs(i << 1, 0);       printf( %d  , color[i << 1]);     }     puts(  );     return 0;   }   