Created
July 5, 2017 13:31
-
-
Save IKKO-Ohta/be9099a23a78b043b3be28e208730fa0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
nums = [int(x) for x in input().split()] | |
N,M = nums[0],nums[1] | |
imos = [0 for i in range(100003)] | |
V = 0 | |
for i in range(N): | |
nums = [int(x) for x in input().split()] | |
a,b,v = nums[0],nums[1],nums[2] | |
V += v | |
imos[a] += v | |
imos[b+1] -= v | |
ans = [] | |
j = 0 | |
for i in imos: | |
ans.append(j+i) | |
j += i | |
print(V-min(ans[1:M+1])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment