a company n employee unique ID employee 0 n 1 the head company headIDEach employee direct manager give manager array manageri direct manager ith employee managerheadID 1 also guarantee subordination relationship tree structureThe head company wants inform company employee urgent piece news he inform direct subordinate inform subordinate employee know urgent newsThe ith employee need informTimei minute inform direct subordinate ie after informTimei minute direct subordinate start spread newsreturn number minute need inform employee urgent news Example 1input n 1 headid 0 manager 1 informtime 0output 0explanation the head company employee companyexample 2input n 6 headid 2 manager 221222 informtime 001000output 1explanation the head company i d 2 direct manager employee company need 1 minute inform allthe tree structure employee company show Constraints1 n 1050 headID nmanagerlength n0 manageri nmanagerheadID 1informtimelength n0 informTimei 1000informtimei 0 employee subordinatesIt guarantee employee inform