# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1108472 | 2024-11-04T08:14:34 Z | vjudge1 | Art Exhibition (JOI18_art) | C++17 | 1 ms | 336 KB |
#include <bits/stdc++.h> #define int long long using namespace std; const int N = 6e5 + 1; int pre[N],n; pair<int,int> a[N]; signed main() { freopen("code.inp","r",stdin); freopen("code.out","w",stdout); cin >> n; for(int i = 1; i <= n; i ++) { cin >> a[i].first >> a[i].second; } sort(a+1,a+n+1); for(int i = 1; i <= n; i ++) { pre[i] = pre[i-1] + a[i].second; } int minn = 1e18,ans = -1e18; for(int i = 1; i <= n; i++) { minn = min(pre[i-1]-a[i].first,minn); ans = max(ans,pre[i] - a[i].first - minn); } cout << ans; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |