Submission #919838

#TimeUsernameProblemLanguageResultExecution timeMemory
919838SuPythonyArt Exhibition (JOI18_art)C++17
0 / 100
1 ms344 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n; cin>>n; vector<pair<ll,ll>> art(n); for (int i=0; i<n; i++) { cin>>art[i].first>>art[i].second; } sort(art.begin(), art.end()); vector<ll> pf(n); pf[0]=art[0].second; for (int i=1; i<n; i++) { pf[i]=pf[i-1]+art[i].second; } ll ans=0; for (int i=0; i<n; i++) { for (int j=i+1; j<n; j++) { ll k; if (i==0) k=0ll; else k=pf[i-1]; ans=max(ans, pf[j]-k-(art[j].first-art[i].first)); } } 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...