func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<int> v[300005], one[300005];   map<pair<int, int>, int> mp;   int size[300005], ji[300005], xx[300005], yy[300005];   char ans[300005];   void dfs1(int p, int fa) {     size[p] = 1;     ji[p]++;     for (int i = 0; i < v[p].size(); i++) {       int to = v[p][i];       if (to == fa || ji[to]) continue;       dfs1(to, p);       size[p] += size[to];     }     for (int i = 0; i < one[p].size(); i++) {       int to = one[p][i];       if (to == fa) continue;       mp[pair<int, int>(p, to)] = 1;       if (ji[to]) continue;       dfs1(to, p);       size[p] += size[to];     }   }   void dfs2(int p, int fa) {     size[p] = 1;     ji[p]++;     for (int i = 0; i < v[p].size(); i++) {       int to = v[p][i];       if (to == fa || ji[to]) continue;       dfs2(to, p);       size[p] += size[to];     }     for (int i = 0; i < one[p].size(); i++) {       int to = one[p][i];       if (to == fa) continue;       mp[pair<int, int>(to, p)] = 1;     }   }   int main() {     int n, m, s, tot = 0;     scanf( %d%d%d , &n, &m, &s);     for (int i = 0; i < m; i++) {       int f, x, y;       scanf( %d%d%d , &f, &x, &y);       if (f == 1)         v[x].push_back(y);       else {         one[x].push_back(y);         one[y].push_back(x);         xx[tot] = x;         yy[tot++] = y;       }     }     dfs1(s, 0);     printf( %d n , size[s]);     for (int i = 0; i < tot; i++) {       if (mp[pair<int, int>(xx[i], yy[i])])         printf( + );       else         printf( - );     }     printf(  n );     memset(ji, 0, sizeof(ji));     mp.clear();     dfs2(s, 0);     printf( %d n , size[s]);     for (int i = 0; i < tot; i++) {       if (mp[pair<int, int>(xx[i], yy[i])])         printf( + );       else         printf( - );     }     printf(  n );     return 0;   }   