Submission #914958

#TimeUsernameProblemLanguageResultExecution timeMemory
914958AiperiiiArt Exhibition (JOI18_art)C++14
100 / 100
389 ms21072 KiB
#include <bits/stdc++.h> #define int long long #define ff first #define ss second #define pb push_back #define all(x) x.begin(),x.end() using namespace std; signed main(){ int n; cin>>n; vector <pair <int,int> > v(n); for(int i=0;i<n;i++){ cin>>v[i].ff>>v[i].ss; } sort(all(v)); int mx=0; int sum=0; int res=0; for(int i=0;i<n;i++){ mx=max(-sum+v[i].ff,mx); sum+=v[i].ss; res=max(res,sum-v[i].ff+mx); } cout<<res<<"\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...