Submission #751158

#TimeUsernameProblemLanguageResultExecution timeMemory
751158WarinchaiArt Exhibition (JOI18_art)C++14
0 / 100
1 ms212 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; vector<pair<long long,long long> >v; long long mn=LLONG_MAX,mx=0; for(int i=0;i<n;i++){ long long a,b; cin>>a>>b; v.push_back({a,b}); if(a<mn){ mn=a; } } sort(v.begin(),v.end()); long long sum=0; for(int i=0;i<n;i++){ sum+=v[i].second; if(sum-(v[i].first-mn)>mx){ mx=sum-(v[i].first-mn); } } cout<<mx; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...