제출 #751161

#제출 시각아이디문제언어결과실행 시간메모리
751161WarinchaiArt Exhibition (JOI18_art)C++17
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=-1*LLONG_MAX; 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...