# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
204696 | 2020-02-26T17:14:25 Z | my99n | Art Exhibition (JOI18_art) | C++14 | 5 ms | 376 KB |
#include<bits/stdc++.h> using namespace std; pair<long long,long long> a[500100]; long long b[500100]; int main(){ int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%lld %lld", &a[i].first, &a[i].second); sort(a, a+n); b[0] = a[0].second; long long ans = b[0]; for (int i = 1; i < n; i++) b[i] = a[i].second - a[i].first + a[i-1].first; for (int i = 1; i < n; i++) b[i] += b[i-1], b[i] = b[i] < 0 ? 0 : b[i], ans = max(ans, b[i]); printf("%lld", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |