We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
n, inputs = [int(n) for n in input().split(" ")]
list = [0]*(n+1)
for _ in range(inputs):
x, y, incr = [int(n) for n in input().split(" ")]
list[x-1] += incr
if((y)<=len(list)): list[y] -= incr;
max = x = 0
for i in list:
x=x+i;
if(max<x): max=x;
print(max)
Array Manipulation
You are viewing a single comment's thread. Return to all comments →
Same solution translated in python -