func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5;   int type[N], n, p[N], out[N];   int go(int u, bool print = false) {     int res = p[u] == -1 || out[p[u]] > 1 ? 1 : go(p[u], print) + 1;     if (print) cout << u + 1 <<    ;     return res;   }   int main() {     cin >> n;     for (int i = 0; i < n; ++i) cin >> type[i];     for (int i = 0; i < n; ++i) {       cin >> p[i];       if (--p[i] >= 0) ++out[p[i]];     }     int res = -1;     for (int i = 0; i < n; ++i)       if (type[i] == 1)         if (res == -1 || go(i) > go(res)) res = i;     cout << go(res) << endl;     go(res, true);     return 0;   }   