제출 #503169

#제출 시각아이디문제언어결과실행 시간메모리
503169jk410Art Exhibition (JOI18_art)C++17
0 / 100
0 ms204 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; struct art{ ll a,b; bool operator<(const art &tmp)const{ return a<tmp.a; } }; int N; art A[500001]; ll Ans; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>N; for (int i=1; i<=N; i++) cin>>A[i].a>>A[i].b; sort(A+1,A+N+1); for (int i=1; i<=N; i++) A[i].b+=A[i-1].b; ll tmp=-A[1].a; for (int i=2; i<=N; i++){ Ans=max(Ans,A[i].b-A[i].a-tmp); tmp=min(tmp,A[i-1].b-A[i].a); } cout<<Ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...