n=int(input())
li=[[*map(int,input().split())]for _ in range(n)]
li.sort(key=lambda x:x[0])
li2=[]
for i in range(n):
if(i==0):li2.append(li[i][1])
else:li2.append(li[i][1]-(li[i][0]-li[i-1][0]))
s=[li2[0]]
for i in range(n-1):
s.append(max(s[i]+li2[i+1],li2[i+1]))
print(max(s))
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
2772 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
2772 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
2772 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
2772 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |