# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
204490 | 2020-02-26T04:26:06 Z | T0p_ | Art Exhibition (JOI18_art) | C++14 | 5 ms | 376 KB |
#include<bits/stdc++.h> using namespace std; struct data { long long a, b; bool operator < (const data & o) const { return a < o.a; } }; long long Ba[500500], B1a[500500]; data arr[500500]; int main() { int n; scanf(" %d",&n); for(int i=1 ; i<=n ; i++) scanf(" %lld %lld",&arr[i].a, &arr[i].b); // sort(arr+1, arr+n+1); for(int i=1 ; i<=n ; i++) { arr[i].b += arr[i-1].b; Ba[i] = arr[i].b - arr[i].a; } for(int i=n ; i>=1 ; i--) Ba[i] = max(Ba[i], Ba[i+1]); for(int i=1 ; i<=n ; i++) B1a[i] = arr[i-1].b - arr[i].a; for(int i=2 ; i<=n ; i++) B1a[i] = min(B1a[i], B1a[i+1]); long long ans = -1e18; for(int i=1 ; i<=n ; i++) ans = max(ans, Ba[i] - B1a[i-1]); printf("%lld\n",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 | - |