# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
526175 | 2022-02-13T21:26:46 Z | Hanksburger | Art Exhibition (JOI18_art) | C++17 | 1 ms | 204 KB |
#include <bits/stdc++.h> using namespace std; pair<long long, long long> a[500005]; vector<long long> v; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, sum=0, ans=0; cin >> n; for (long long i=1; i<=n; i++) cin >> a[i].first >> a[i].second; sort(a+1, a+n+1); v.push_back(a[1].second); for (long long i=2; i<=n; i++) v.push_back(a[i].second-a[i].first+a[i-1].first); for (long long i=0; i<v.size(); i++) { sum=max(0LL, sum+v[i]); ans=max(ans, sum); } cout << ans; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |