# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1075987 | 2024-08-26T10:18:22 Z | trandangquang | Art Exhibition (JOI18_art) | C++14 | 163 ms | 21008 KB |
#include <bits/stdc++.h> using namespace std; #define task "test" #define FOR(i, a, b) for(int i = (a); i <= (b); ++i) #define FORD(i, a, b) for(int i = (a); i >= (b); --i) #define sz(a) (int)(a).size() #define all(a) (a).begin(), (a).end() #define bit(s, i) (((s) >> (i)) & 1) #define ii pair <int, int> #define vii vector <ii> #define vi vector <int> #define fi first #define se second #define int long long #define ll long long #define eb emplace_back #define pb push_back #define __builtin_popcount __builtin_popcountll void solve(); int32_t main() { if(fopen(task".inp", "r")) { freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout); } cin.tie(0)->sync_with_stdio(0); solve(); } const int N = 500005; const int INFLL = 1e18; int n; ii a[N]; void solve() { cin >> n; FOR(i, 1, n) cin>>a[i].fi>>a[i].se; sort(a+1, a+1+n); int mi = INFLL, cur = 0, res = 0; FOR(i, 1, n) { mi = min(mi, cur-a[i].fi); cur += a[i].se; res = max(res, cur-a[i].fi-mi); } cout << res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 464 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 464 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 468 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 344 KB | Output is correct |
22 | Correct | 0 ms | 348 KB | Output is correct |
23 | Correct | 0 ms | 348 KB | Output is correct |
24 | Correct | 0 ms | 348 KB | Output is correct |
25 | Correct | 1 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 464 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 468 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 344 KB | Output is correct |
22 | Correct | 0 ms | 348 KB | Output is correct |
23 | Correct | 0 ms | 348 KB | Output is correct |
24 | Correct | 0 ms | 348 KB | Output is correct |
25 | Correct | 1 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 348 KB | Output is correct |
27 | Correct | 2 ms | 604 KB | Output is correct |
28 | Correct | 2 ms | 600 KB | Output is correct |
29 | Correct | 1 ms | 604 KB | Output is correct |
30 | Correct | 2 ms | 604 KB | Output is correct |
31 | Correct | 1 ms | 604 KB | Output is correct |
32 | Correct | 1 ms | 604 KB | Output is correct |
33 | Correct | 2 ms | 600 KB | Output is correct |
34 | Correct | 2 ms | 604 KB | Output is correct |
35 | Correct | 1 ms | 604 KB | Output is correct |
36 | Correct | 1 ms | 604 KB | Output is correct |
37 | Correct | 1 ms | 604 KB | Output is correct |
38 | Correct | 2 ms | 476 KB | Output is correct |
39 | Correct | 2 ms | 604 KB | Output is correct |
40 | Correct | 1 ms | 604 KB | Output is correct |
41 | Correct | 2 ms | 604 KB | Output is correct |
42 | Correct | 2 ms | 604 KB | Output is correct |
43 | Correct | 1 ms | 604 KB | Output is correct |
44 | Correct | 1 ms | 604 KB | Output is correct |
45 | Correct | 1 ms | 604 KB | Output is correct |
46 | Correct | 1 ms | 604 KB | Output is correct |
47 | Correct | 2 ms | 604 KB | Output is correct |
48 | Correct | 1 ms | 600 KB | Output is correct |
49 | Correct | 1 ms | 604 KB | Output is correct |
50 | Correct | 1 ms | 636 KB | Output is correct |
51 | Correct | 2 ms | 604 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 464 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 468 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 344 KB | Output is correct |
22 | Correct | 0 ms | 348 KB | Output is correct |
23 | Correct | 0 ms | 348 KB | Output is correct |
24 | Correct | 0 ms | 348 KB | Output is correct |
25 | Correct | 1 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 348 KB | Output is correct |
27 | Correct | 2 ms | 604 KB | Output is correct |
28 | Correct | 2 ms | 600 KB | Output is correct |
29 | Correct | 1 ms | 604 KB | Output is correct |
30 | Correct | 2 ms | 604 KB | Output is correct |
31 | Correct | 1 ms | 604 KB | Output is correct |
32 | Correct | 1 ms | 604 KB | Output is correct |
33 | Correct | 2 ms | 600 KB | Output is correct |
34 | Correct | 2 ms | 604 KB | Output is correct |
35 | Correct | 1 ms | 604 KB | Output is correct |
36 | Correct | 1 ms | 604 KB | Output is correct |
37 | Correct | 1 ms | 604 KB | Output is correct |
38 | Correct | 2 ms | 476 KB | Output is correct |
39 | Correct | 2 ms | 604 KB | Output is correct |
40 | Correct | 1 ms | 604 KB | Output is correct |
41 | Correct | 2 ms | 604 KB | Output is correct |
42 | Correct | 2 ms | 604 KB | Output is correct |
43 | Correct | 1 ms | 604 KB | Output is correct |
44 | Correct | 1 ms | 604 KB | Output is correct |
45 | Correct | 1 ms | 604 KB | Output is correct |
46 | Correct | 1 ms | 604 KB | Output is correct |
47 | Correct | 2 ms | 604 KB | Output is correct |
48 | Correct | 1 ms | 600 KB | Output is correct |
49 | Correct | 1 ms | 604 KB | Output is correct |
50 | Correct | 1 ms | 636 KB | Output is correct |
51 | Correct | 2 ms | 604 KB | Output is correct |
52 | Correct | 135 ms | 20728 KB | Output is correct |
53 | Correct | 127 ms | 20840 KB | Output is correct |
54 | Correct | 122 ms | 20892 KB | Output is correct |
55 | Correct | 121 ms | 20716 KB | Output is correct |
56 | Correct | 130 ms | 20740 KB | Output is correct |
57 | Correct | 163 ms | 20928 KB | Output is correct |
58 | Correct | 138 ms | 20812 KB | Output is correct |
59 | Correct | 115 ms | 20816 KB | Output is correct |
60 | Correct | 122 ms | 20724 KB | Output is correct |
61 | Correct | 124 ms | 20564 KB | Output is correct |
62 | Correct | 128 ms | 20804 KB | Output is correct |
63 | Correct | 132 ms | 20820 KB | Output is correct |
64 | Correct | 149 ms | 21008 KB | Output is correct |
65 | Correct | 132 ms | 20784 KB | Output is correct |
66 | Correct | 128 ms | 20936 KB | Output is correct |
67 | Correct | 124 ms | 20936 KB | Output is correct |
68 | Correct | 124 ms | 20868 KB | Output is correct |