n = int(input())
x = int(input())
ans = 0
for i in range(n):
p1, p2 = map(int, input().split())
if abs(p1 - p2) <= x:
ans += max(p1, p2)
else:
ans += int(input())
print(ans)
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
2896 KB |
Output is correct |
2 |
Correct |
13 ms |
2888 KB |
Output is correct |
3 |
Correct |
12 ms |
2896 KB |
Output is correct |
4 |
Correct |
13 ms |
2704 KB |
Output is correct |
5 |
Correct |
14 ms |
2896 KB |
Output is correct |
6 |
Correct |
13 ms |
2896 KB |
Output is correct |
7 |
Correct |
13 ms |
2896 KB |
Output is correct |
8 |
Correct |
12 ms |
2896 KB |
Output is correct |
9 |
Correct |
12 ms |
2744 KB |
Output is correct |
10 |
Correct |
13 ms |
2896 KB |
Output is correct |