제출 #718160

#제출 시각아이디문제언어결과실행 시간메모리
718160Yell0Art Exhibition (JOI18_art)C++17
50 / 100
1029 ms24204 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; const int MN=5e5+2; int N; pll a[MN]; ll pfs[MN],ans=0; int main() { ios::sync_with_stdio(0);cin.tie(0); cin>>N; for(int i=1;i<=N;++i) cin>>a[i].first>>a[i].second; sort(a+1,a+1+N); for(int i=1;i<=N;++i) pfs[i]=pfs[i-1]+a[i].second; for(int i=1;i<=N;++i) for(int j=1;j<=i;++j) ans=max(ans,pfs[i]-pfs[j-1]-(a[i].first-a[j].first)); cout<<ans<<'\n'; 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...