Submission #850426

#TimeUsernameProblemLanguageResultExecution timeMemory
850426Bach21Art Exhibition (JOI18_art)C++14
100 / 100
537 ms17444 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int n; vector<pair<ll,ll>> v; signed main() { cin >> n; for (int i=0;i<n;i++) { ll x,y; cin >> x >> y; v.push_back({x,y}); } sort(v.begin(),v.end()); ll lo=0; ll sum=0; ll res=0; for (auto x : v) { lo=min(lo,sum-x.first); sum+=x.second; res=max(res,sum-x.first-lo); } cout << res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...