| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1367196 | edo | Art Exhibition (JOI18_art) | C++20 | 98 ms | 8260 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<pair<ll, ll>> v(n);
for(int i = 0; i < n; ++i) {
ll a, b;
cin >> a >> b;
v[i] = {a, b};
}
ranges::sort(v);
ll ans = -(1ll << 60), best = ans, pref = 0;
for(auto [x, y] : v) {
ans = max(ans, y);
ans = max(ans, pref + y - x + best);
best = max(best, x - pref);
pref += y;
}
cout << ans << "\n";
return 0;
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
