func_code_string: #include <bits/stdc++.h>   using namespace std;   const int M = 1e5 + 10;   int a[M], col[M], flag;   bool vis[M];   vector<int> vc[M];   vector<pair<int, int> > node[M];   void bfs(int sta) {     col[sta] = 0;     vis[sta] = true;     queue<int> q;     q.push(sta);     while (!q.empty()) {       int u = q.front();       q.pop();       int len = node[u].size();       for (int i = 0; i < len; i++) {         int co = col[u];         pair<int, int> v = node[u][i];         if (v.second == 0) {           co ^= 1;         }         if (vis[v.first] && col[v.first] != co) {           flag = false;           return;         }         if (!vis[v.first]) {           col[v.first] = co;           vis[v.first] = true;           q.push(v.first);         }       }     }   }   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);     }     for (int i = 1; i <= m; i++) {       int sz;       scanf( %d , &sz);       for (int j = 1; j <= sz; j++) {         int x;         scanf( %d , &x);         vc[x].push_back(i);       }     }     for (int i = 1; i <= n; i++) {       int u = vc[i][0], v = vc[i][1];       node[v].push_back(make_pair(u, a[i]));       node[u].push_back(make_pair(v, a[i]));     }     memset(vis, false, sizeof(vis));     memset(col, -1, sizeof(col));     flag = true;     for (int i = 1; i <= m; i++) {       if (!vis[i]) {         bfs(i);       }     }     if (flag)       printf( YES n );     else       printf( NO n );     return 0;   }   