Submission #382149

#TimeUsernameProblemLanguageResultExecution timeMemory
382149IwanttobreakfreeArt Exhibition (JOI18_art)C++17
50 / 100
1080 ms8172 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ long long int n; cin>>n; vector<pair<long long int,long long int> >art(n+1); art[0]=make_pair(0,0); for(int i=1;i<=n;i++)cin>>art[i].first>>art[i].second; sort(art.begin(),art.end()); for(int i=1;i<=n;i++){ art[i].second+=art[i-1].second; //cout<<art[i].second<<' '; } long long int maxi=0; for(int i=0;i<n;i++){ for(int j=i+1;j<=n;j++){ long long int dist=art[j].first-art[i+1].first; long long int val=art[j].second-art[i].second; if(val-dist>maxi)maxi=val-dist; //cout<<val<<' '<<dist<<' '; } } cout<<maxi<<'\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...