Submission #538258

#TimeUsernameProblemLanguageResultExecution timeMemory
538258tkwiatkowskiArt Exhibition (JOI18_art)Cpython 3
50 / 100
1095 ms93700 KiB
def solve(): n = int(input()) artworks = [] for i in range(n): artworks.append(list(map(int, input().split()))) artworks.sort() maxx = -10**18 ans = 0 pref = 0 for a, b in 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...