# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
292417 | Ruba_K | Art Exhibition (JOI18_art) | C++14 | 1098 ms | 20728 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.
#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 1 ;
#define ll long long
int main()
{ios_base::sync_with_stdio(false);cin.tie(0);
int n ;
cin >> n ;
vector<pair<ll , ll > > v (n);
for(auto &it : v)
cin >> it.first >> it.second ;
sort(v.begin() , v.end());
ll mx = 0 , past ;
for(int i = 0 ; i < n ; i ++){
if(v[i].first == past)continue ;
ll sum = 0 ;
for(int j = i; j < n ; j ++){
ll d = v[j].first - v[i].first;
sum += v[j++].second ;
j -- ;
mx = max(mx , sum - d );
}
past = v[i].first ;
}
cout << mx ;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |