# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
699393 | Mo7amed_Hossam | Art Exhibition (JOI18_art) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/** created by Mohamed hossam #### #### ## ## ## ## ## ## ##### ## ## ###### ## ## ## ## ## ## ## ####### ############## ## ## ######## ## ###### ## ## ## ####### ############## ######### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ### ### ##### ## ## ## ## ## ####### ########*/#include <bits/stdc++.h>#define ll long long#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std;ll n; int main(){ fast; cin>>n; pair<ll,ll>a[n]; for(ll i=0; i<n; i++) { cin>>a[i].first>>a[i].second; } sort(a,a+n); ll k=-1e18; for(ll i=0; i<n; i++) { ll b=a[i]. second; for(ll j=i+1; j<n; j++) { b+=a[j].second; k=max(k,b-(a[j]. first-a[i]. first)); } }cout<<k; return 0;}