static int go ( int id ) {
  if ( id == - 1 ) return - 1000000 ;
  int [ ] cnt = new int [ ls [ id ] . length ] ;
  int mixes = 0 ;
  for ( int i = 0 ;
  i < cnt . length ;
  i ++ ) {
    if ( ls [ id ] [ i ] >= 0 ) mixes ++ ;
    cnt [ i ] = go ( ls [ id ] [ i ] ) ;
  }
  Arrays . sort ( cnt ) ;
  int ret = 1 ;
  for ( int i = 0 ;
  i < cnt . length ;
  i ++ ) {
    ret = Math . max ( ret , cnt [ i ] + cnt . length - i - 1 ) ;
  }
  return Math . max ( ret , mixes + 1 ) ;
}

static int go ( int id ) { if ( id == - 1 ) return - 1000000 ; int [ ] cnt = new int [ ls [ id ] . length ] ; int mixes = 0 ; for ( int i = 0 ; i < cnt . length ; i ++ ) { if ( ls [ id ] [ i ] >= 0 ) mixes ++ ; cnt [ i ] = go ( ls [ id ] [ i ] ) ; } Arrays . sort ( cnt ) ; int ret = 1 ; for ( int i = 0 ; i < cnt . length ; i ++ ) { ret = Math . max ( ret , cnt [ i ] + cnt . length - i - 1 ) ; } return Math . max ( ret , mixes + 1 ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (unary_expression operand: (decimal_integer_literal)))) consequence: (return_statement (unary_expression operand: (decimal_integer_literal)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation name: (identifier) arguments: (argument_list (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (field_access object: (identifier) field: (identifier))) right: (identifier)) right: (decimal_integer_literal)))))))) (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)))))))