제출 #701308

#제출 시각아이디문제언어결과실행 시간메모리
701308NourWaelArt Exhibition (JOI18_art)C++14
0 / 100
0 ms212 KiB
#include <iostream> #include <bits/stdc++.h> typedef long long ll; using namespace std; int n; vector<pair<ll,ll>>v; int main() { cin>>n; v.resize(n); for(int i=0;i<n;i++) { cin>>v[i].first>>v[i].second; } sort(v.begin(),v.end()); ll ans=v[0].second; ll mini=v[0].first; ll tValue=v[0].second; ll ans2=0; for(int i=1;i<n;i++) { tValue+=v[i].second; ll maxx=v[i].first; ans2=tValue-(maxx-mini); if(ans2>ans)ans=ans2; } cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...