問題
C – ハイスコア
回答
30点回答を考えます。
AtCoder Beginner Contest 017 解説 from AtCoder Inc.
N, M = map(int, input().split()) lrs = [list(map(int, input().split())) for _ in range(N)] # その遺跡攻略で覆われる区間 interval_covered = [[False] * (M+1) for _ in range(N)] for i in range(N): l = lrs[i][0] r = lrs[i][1] for j in range(l, r+1): interval_covered[i][j] = True ans = 0 for j in range(1, M+1): cur = 0 for i in range(N): score = lrs[i][2] if not(interval_covered[i][j]): cur += score ans = max(ans, cur) print(ans)