Submission #698185

#TimeUsernameProblemLanguageResultExecution timeMemory
698185zzzzzzzzzzzzzzzArt Exhibition (JOI18_art)Cpython 3
0 / 100
13 ms2772 KiB
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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...