func_code_string: #include <bits/stdc++.h>   using namespace std;   int N, M;   vector<int> adj[100002], f, radj[100002];   queue<int> Q1, Q2;   vector<int> vis;   int main(int argc, char **argv) {     cin >> N >> M;     f = vector<int>(N);     for (int i = (0); i < (N); ++i) cin >> f[i];     for (int i = (0); i < (M); ++i) {       int first, second;       cin >> first >> second;       --first, --second;       adj[first].push_back(second);       radj[second].push_back(first);     }     vis = vector<int>(N);     for (int i = (0); i < (N); ++i)       if (f[i] == 1)         Q1.push(i), vis[i] |= 1;       else if (f[i] == 2)         Q2.push(i), vis[i] |= 2;     while (!Q1.empty()) {       int u = Q1.front();       Q1.pop();       for (int i = (0); i < (adj[u].size()); ++i)         if (!(vis[adj[u][i]] & 1) && f[adj[u][i]] != 1) {           vis[adj[u][i]] |= 1;           Q1.push(adj[u][i]);         }     }     while (!Q2.empty()) {       int u = Q2.front();       Q2.pop();       for (int i = (0); i < (radj[u].size()); ++i)         if (!(vis[radj[u][i]] >> 1)) {           vis[radj[u][i]] |= 2;           if (f[radj[u][i]] != 1) Q2.push(radj[u][i]);         }     }     for (int i = (0); i < (N); ++i) printf( %d n , vis[i] == 3);     return 0;   }   