Submission #384308

#TimeUsernameProblemLanguageResultExecution timeMemory
384308IwanttobreakfreeArt Exhibition (JOI18_art)C++17
50 / 100
1079 ms20716 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); 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; } 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<<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...