func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     vector<stack<int> > vs;     int maxi = -1, maximum = 0, nbVertices, n, type[100009], destination[100009],         source[100009];     cin >> n;     vs = vector<stack<int> >(n);     for (int i = 0; i < n; ++i) {       source[i] = 0;     }     for (int i = 0; i < n; ++i) {       cin >> type[i];     }     for (int i = 0; i < n; ++i) {       cin >> destination[i];       destination[i] -= 1;       if (destination[i] != -1) source[destination[i]]++;     }     for (int i = 0; i < n; ++i) {       if (type[i]) {         int j = i;         nbVertices = 1;         while (source[destination[j]] == 1 && destination[j] != -1) {           ++nbVertices;           vs[i].push(j + 1);           j = destination[j];         }         vs[i].push(j + 1);         if (maximum < nbVertices) {           maximum = nbVertices;           maxi = i;         }       }     }     cout << maximum << endl;     while (vs[maxi].size()) {       int top = vs[maxi].top();       cout << top <<    ;       vs[maxi].pop();     }     cout << endl;     return 0;   }   