제출 #312440

#제출 시각아이디문제언어결과실행 시간메모리
312440a_playerArt Exhibition (JOI18_art)C++14
50 / 100
1083 ms20892 KiB
#include <bits/stdc++.h> #define f first #define s second using namespace std; typedef long long ll; int main(){ int n; cin>>n; vector<pair<ll,ll> > a(n); for(int i=0;i<n;i++)cin>>a[i].f>>a[i].s; sort(a.begin(),a.end()); ll mini=-a[0].f; ll mas=LLONG_MIN; ll s=0; for(int i=0;i<n;i++){ mini=min(mini,s-a[i].f); s+=a[i].s; mas=max(mas,s-mini-a[i].f); } cout<<mas<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...