# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
64134 | 2018-08-03T11:53:55 Z | keko37 | Art Exhibition (JOI18_art) | C++14 | 2 ms | 248 KB |
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; typedef long long llint; const int MAXN = 500005; llint n, sol, mx; llint s[MAXN]; pair <llint, llint> p[MAXN]; int main () { cin >> n; for (int i=1; i<=n; i++) { scanf("%lld%lld", &p[i].first, &p[i].second); } sort(p+1, p+n+1); for (int i=1; i<=n; i++) { s[i] = p[i].second + s[i-1]; } for (int i=n; i>=1; i--) { mx = max(mx, s[i] - p[i].first); sol = max(sol, mx + p[i].first - s[i-1]); } cout << sol; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 248 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 248 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 248 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 248 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |