You are viewing a single comment's thread. Return to all comments →
My Solution is the similar, but it can not pass testcases 7-13, because "Runtime Error".
I downloaded input\output data for 7th testcase and it's pass locally.
What is wrong?
$handle = fopen ("php://stdin", "r"); fscanf($handle, "%i %i", $n, $m); $h = array_fill_keys(range(0, $n), 0); for($a0 = 0; $a0 < $m; $a0++){ fscanf($handle, "%i %i %i", $a, $b, $k); $h[$a-1] += $k; $h[$b] -=$k; } $prev = 0; $max = PHP_INT_MIN; foreach($h as $value){ $prev += $value; if($prev > $max) $max = $prev; } echo $max;
Seems like cookies are disabled on this browser, please enable them to open this website
Array Manipulation
You are viewing a single comment's thread. Return to all comments →
My Solution is the similar, but it can not pass testcases 7-13, because "Runtime Error".
I downloaded input\output data for 7th testcase and it's pass locally.
What is wrong?