제출 #538262

#제출 시각아이디문제언어결과실행 시간메모리
538262tkwiatkowskiArt Exhibition (JOI18_art)Pypy 3
50 / 100
1090 ms80884 KiB
from sys import stdin input = stdin.readline def solve(): n = int(input()) artworks = [list(map(int, input().split())) for i in range(n)] maxx = -10**18 ans = 0 pref = 0 for a, b in sorted(artworks): maxx = max(a - pref, maxx) pref += b ans = max(maxx + pref - a, ans) print(ans) solve()
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...