Main.java 771 B

1234567891011121314151617181920212223242526272829303132333435
  1. import java.util.*;
  2. public class Main {
  3. private static final int MOD = 1000000007;
  4. private static class Node {
  5. int color;
  6. ArrayList<Node> children;
  7. Node() {
  8. this.children = new ArrayList<>();
  9. }
  10. }
  11. public static void main(String[] args) {
  12. Scanner scanner = new Scanner(System.in);
  13. int n = scanner.nextInt();
  14. Node[] nodes = new Node[n];
  15. nodes[0] = new Node();
  16. for (int i = 1, father; i < n; i++) {
  17. father = scanner.nextInt();
  18. nodes[i] = new Node();
  19. nodes[father].children.add(nodes[i]);
  20. }
  21. for (int i = 0; i < n; i++)
  22. nodes[i].color = scanner.nextInt();
  23. scanner.close();
  24. System.out.println(cutTree(nodes[0]));
  25. }
  26. private static int cutTree(Node root) {
  27. return 0;
  28. }
  29. }