Submission #548841

#TimeUsernameProblemLanguageResultExecution timeMemory
548841Specialistas13Art Exhibition (JOI18_art)C++17
50 / 100
1087 ms8080 KiB
#include <bits/stdc++.h> using namespace std; int N; pair<long long, long long> v[600000]; long long maxi=0, minid=0, maxid=0, S=0; int main() { cin>>N; for (int i=0; i<N; i++){ long long a, b; cin>>a>>b; v[i]={a, b}; } sort(v, v+N); for (int i=0; i<N; i++){ S=v[i].second; minid=v[i].first; maxid=v[i].first; maxi=max(maxi, (S-(maxid-minid))); for (int j=i+1; j<N; j++){ S+=v[j].second; maxid=max(maxid, v[j].first); minid=min(minid, v[j].first); maxi=max(maxi, (S-(maxid-minid))); } } cout<<maxi; 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...