# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
542056 | 2022-03-25T09:18:10 Z | lunchbox | Art Exhibition (JOI18_art) | C++17 | 0 ms | 212 KB |
#include <bits/stdc++.h> using namespace std; int main() { long long ans, mx; int n; scanf("%d", &n); vector<pair<long long, long long>> a(n); for (auto &[x, y] : a) scanf("%lld%lld", &x, &y); sort(a.begin(), a.end()); for (int i = 0; i + 1 < n; i++) a[i + 1].second += a[i].second; mx = 0, ans = -0x3f3f3f3f3f3f3f3f; for (int i = 0; i < n; i++) { ans = max(ans, a[i].second - a[i].first + mx); mx = max(mx, a[i].first - (i == 0 ? 0 : a[i - 1].second)); } printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |