Untitled
unknown
python
a year ago
399 B
1
Indexable
Never
f = open("27.2.B.txt") n, m = map(int, f.readline().split()) a = [0]*10000000 for s in f: km, litr = map(int, s.split()) if litr % 15 == 0: a[km] = litr // 15 else: a[km] = litr // 15 + 1 result = [sum(a[0:2*m + 1])] x = result[-1] for i in range(m + 1, n - m): x += a[i + m] - a[i - m - 1] if a[i] != 0: result.append(x) print(max(result))