# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
486855 | 2021-11-13T02:20:34 Z | TypeYippie | Art Exhibition (JOI18_art) | C++14 | 0 ms | 204 KB |
#include <bits/stdc++.h> using namespace std; const int N = 5e5+5; int n; pair<long long, long long> art[N]; long long pref[N]; int main(){ scanf("%d", &n); for(int i = 1; i <= n; i++){ scanf("%lld%lld", &art[i].first, &art[i].second); } sort(art+1, art+n+1); pref[0] = 0; for(int i = 1; i <= n; i++){ pref[i] = pref[i-1]+art[i].second; } priority_queue<long long> pq; long long ans = 0; for(int i = n; i > 0; i--){ if(i < n){ ans = max(ans, (pq.top()-pref[i-1])+art[i].first); } pq.push(pref[i]-art[i].first); } printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |