| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 141516 | osaaateiasavtnl | Art Exhibition (JOI18_art) | C++14 | 289 ms | 21012 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;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
const int N = 5e5 + 7, INF = 1e18 + 7;
ii a[N];
signed main() {
#ifdef HOME
freopen("input.txt", "r", stdin);
#else
ios_base::sync_with_stdio(0); cin.tie(0);
#endif
int n; cin >> n; for (int i = 0; i < n; ++i) cin >> a[i].first >> a[i].second;
sort(a, a + n); int cur = -INF, p = 0, ans = -INF;
for (int i = 0; i < n; ++i) {
cur = max(cur, a[i].first - p);
p += a[i].second;
ans = max(ans, p - a[i].first + cur);
}
cout << ans << '\n';
} | # | 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... | ||||
