func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 100000;   int n, m, k, start = MAXN + 1;   int type[MAXN + 3], a[MAXN + 3], counter[MAXN + 3], stc[MAXN + 3];   bool check[MAXN + 3];   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &type[i]);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     for (int i = 1; i <= n; i++) counter[a[i]]++;     for (int i = 1; i <= n; i++)       if (counter[i] == 1) check[i] = true;     int cnt = 0;     for (int i = n; i >= 1; i--) {       if (type[i] == 1) {         cnt = 1;         int v = a[i];         while (v != 0 && check[v]) {           cnt++;           v = a[v];         }         if (cnt > k) k = cnt, start = i;       }     }     printf( %d n , k);     for (int i = 0, v = start; i < k; i++, v = a[v]) stc[i] = v;     for (int i = k - 1; i >= 0; i--) printf( %d  , stc[i]);     puts(  );     return 0;   }   