# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
754319 | KN200711 | Art Exhibition (JOI18_art) | C++14 | 206 ms | 20764 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>
# define ll long long
# define fi first
# define se second
using namespace std;
int main() {
int N;
scanf("%d", &N);
vector< pair<ll, ll> > arr(N);
for(int i=0;i<N;i++) scanf("%lld %lld", &arr[i].fi, &arr[i].se);
sort(arr.begin(), arr.end());
ll mn = 1e18, pref = 0ll, ans = 0ll;
for(int i=0;i<N;i++) {
mn = min(mn, pref - 1ll * arr[i].fi);
pref += arr[i].se;
ans = max(ans, pref - arr[i].fi - mn);
}
printf("%lld\n", ans);
}
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... |