ccf小明种苹果 (续) #ccf小明种苹果 (续) n = int ( input ( ) ) a , d = [ ] , [ ] for i in range ( n ) : a . append ( list ( map ( int , input ( ) . split ( ) ) ) ) t , p , k = 0 , 0 , 0 for i in range ( n ) : a [ i ] . append ( 0 ) temp = a [ i ] [ 1 ] if a [ i ] [ 0 ] >= 1 : for j in range ( 2 , a [ i ] [ 0 ] + 1 ) : if a [ i ] [ j ] <= 0 : temp += a [ i ] [ j ] else : #if temp > a[i][j] and len(d)>0 and d[-1]!=i: #len(d)>0导致第一次加不上 if temp > a [ i ] [ j ] and ( len ( d ) == 0 or ( len ( d ) > 0 and d [ - 1 ] != i ) ) : d . append ( i ) #一棵树掉几次的情况??? temp = a [ i ] [ j ] a [ i ] [ - 1 ] = temp for i in