# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
75106 | 2018-09-08T11:25:41 Z | bogdan10bos | Art Exhibition (JOI18_art) | C++14 | 279 ms | 227196 KB |
#include <bits/stdc++.h> using namespace std; //#define FILE_IO typedef long long LL; typedef pair<LL, LL> pll; int N; pll v[500005]; int main() { #ifdef FILE_IO freopen("1.in", "r", stdin); freopen("1.out", "w", stdout); #endif scanf("%d", &N); for(int i = 1; i <= N; i++) { LL x, y; scanf("%lld%lld", &x, &y); v[i] = {x, y}; } sort(v + 1, v + N + 1); LL ans = -(1LL << 60), sum = 0LL, bst = -(1LL << 60); for(int i = 1; i <= N; i++) { bst = max(bst, v[i].first - sum); sum += v[i].second; ans = max(ans, sum - v[i].first + bst); } printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 3 ms | 600 KB | Output is correct |
5 | Correct | 2 ms | 620 KB | Output is correct |
6 | Correct | 2 ms | 756 KB | Output is correct |
7 | Correct | 2 ms | 756 KB | Output is correct |
8 | Correct | 2 ms | 756 KB | Output is correct |
9 | Correct | 2 ms | 756 KB | Output is correct |
10 | Correct | 2 ms | 756 KB | Output is correct |
11 | Correct | 3 ms | 756 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 3 ms | 600 KB | Output is correct |
5 | Correct | 2 ms | 620 KB | Output is correct |
6 | Correct | 2 ms | 756 KB | Output is correct |
7 | Correct | 2 ms | 756 KB | Output is correct |
8 | Correct | 2 ms | 756 KB | Output is correct |
9 | Correct | 2 ms | 756 KB | Output is correct |
10 | Correct | 2 ms | 756 KB | Output is correct |
11 | Correct | 3 ms | 756 KB | Output is correct |
12 | Correct | 2 ms | 760 KB | Output is correct |
13 | Correct | 2 ms | 772 KB | Output is correct |
14 | Correct | 2 ms | 812 KB | Output is correct |
15 | Correct | 2 ms | 836 KB | Output is correct |
16 | Correct | 3 ms | 860 KB | Output is correct |
17 | Correct | 2 ms | 868 KB | Output is correct |
18 | Correct | 2 ms | 876 KB | Output is correct |
19 | Correct | 2 ms | 904 KB | Output is correct |
20 | Correct | 2 ms | 908 KB | Output is correct |
21 | Correct | 2 ms | 916 KB | Output is correct |
22 | Correct | 3 ms | 924 KB | Output is correct |
23 | Correct | 2 ms | 932 KB | Output is correct |
24 | Correct | 2 ms | 944 KB | Output is correct |
25 | Correct | 2 ms | 948 KB | Output is correct |
26 | Correct | 2 ms | 956 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 3 ms | 600 KB | Output is correct |
5 | Correct | 2 ms | 620 KB | Output is correct |
6 | Correct | 2 ms | 756 KB | Output is correct |
7 | Correct | 2 ms | 756 KB | Output is correct |
8 | Correct | 2 ms | 756 KB | Output is correct |
9 | Correct | 2 ms | 756 KB | Output is correct |
10 | Correct | 2 ms | 756 KB | Output is correct |
11 | Correct | 3 ms | 756 KB | Output is correct |
12 | Correct | 2 ms | 760 KB | Output is correct |
13 | Correct | 2 ms | 772 KB | Output is correct |
14 | Correct | 2 ms | 812 KB | Output is correct |
15 | Correct | 2 ms | 836 KB | Output is correct |
16 | Correct | 3 ms | 860 KB | Output is correct |
17 | Correct | 2 ms | 868 KB | Output is correct |
18 | Correct | 2 ms | 876 KB | Output is correct |
19 | Correct | 2 ms | 904 KB | Output is correct |
20 | Correct | 2 ms | 908 KB | Output is correct |
21 | Correct | 2 ms | 916 KB | Output is correct |
22 | Correct | 3 ms | 924 KB | Output is correct |
23 | Correct | 2 ms | 932 KB | Output is correct |
24 | Correct | 2 ms | 944 KB | Output is correct |
25 | Correct | 2 ms | 948 KB | Output is correct |
26 | Correct | 2 ms | 956 KB | Output is correct |
27 | Correct | 5 ms | 1092 KB | Output is correct |
28 | Correct | 5 ms | 1224 KB | Output is correct |
29 | Correct | 5 ms | 1348 KB | Output is correct |
30 | Correct | 5 ms | 1480 KB | Output is correct |
31 | Correct | 5 ms | 1604 KB | Output is correct |
32 | Correct | 5 ms | 1732 KB | Output is correct |
33 | Correct | 5 ms | 1860 KB | Output is correct |
34 | Correct | 5 ms | 2000 KB | Output is correct |
35 | Correct | 5 ms | 2116 KB | Output is correct |
36 | Correct | 5 ms | 2244 KB | Output is correct |
37 | Correct | 5 ms | 2372 KB | Output is correct |
38 | Correct | 5 ms | 2500 KB | Output is correct |
39 | Correct | 5 ms | 2628 KB | Output is correct |
40 | Correct | 5 ms | 2756 KB | Output is correct |
41 | Correct | 5 ms | 2904 KB | Output is correct |
42 | Correct | 5 ms | 3008 KB | Output is correct |
43 | Correct | 5 ms | 3124 KB | Output is correct |
44 | Correct | 5 ms | 3264 KB | Output is correct |
45 | Correct | 5 ms | 3392 KB | Output is correct |
46 | Correct | 4 ms | 3524 KB | Output is correct |
47 | Correct | 5 ms | 3652 KB | Output is correct |
48 | Correct | 5 ms | 3780 KB | Output is correct |
49 | Correct | 5 ms | 3912 KB | Output is correct |
50 | Correct | 5 ms | 4036 KB | Output is correct |
51 | Correct | 5 ms | 4164 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 3 ms | 600 KB | Output is correct |
5 | Correct | 2 ms | 620 KB | Output is correct |
6 | Correct | 2 ms | 756 KB | Output is correct |
7 | Correct | 2 ms | 756 KB | Output is correct |
8 | Correct | 2 ms | 756 KB | Output is correct |
9 | Correct | 2 ms | 756 KB | Output is correct |
10 | Correct | 2 ms | 756 KB | Output is correct |
11 | Correct | 3 ms | 756 KB | Output is correct |
12 | Correct | 2 ms | 760 KB | Output is correct |
13 | Correct | 2 ms | 772 KB | Output is correct |
14 | Correct | 2 ms | 812 KB | Output is correct |
15 | Correct | 2 ms | 836 KB | Output is correct |
16 | Correct | 3 ms | 860 KB | Output is correct |
17 | Correct | 2 ms | 868 KB | Output is correct |
18 | Correct | 2 ms | 876 KB | Output is correct |
19 | Correct | 2 ms | 904 KB | Output is correct |
20 | Correct | 2 ms | 908 KB | Output is correct |
21 | Correct | 2 ms | 916 KB | Output is correct |
22 | Correct | 3 ms | 924 KB | Output is correct |
23 | Correct | 2 ms | 932 KB | Output is correct |
24 | Correct | 2 ms | 944 KB | Output is correct |
25 | Correct | 2 ms | 948 KB | Output is correct |
26 | Correct | 2 ms | 956 KB | Output is correct |
27 | Correct | 5 ms | 1092 KB | Output is correct |
28 | Correct | 5 ms | 1224 KB | Output is correct |
29 | Correct | 5 ms | 1348 KB | Output is correct |
30 | Correct | 5 ms | 1480 KB | Output is correct |
31 | Correct | 5 ms | 1604 KB | Output is correct |
32 | Correct | 5 ms | 1732 KB | Output is correct |
33 | Correct | 5 ms | 1860 KB | Output is correct |
34 | Correct | 5 ms | 2000 KB | Output is correct |
35 | Correct | 5 ms | 2116 KB | Output is correct |
36 | Correct | 5 ms | 2244 KB | Output is correct |
37 | Correct | 5 ms | 2372 KB | Output is correct |
38 | Correct | 5 ms | 2500 KB | Output is correct |
39 | Correct | 5 ms | 2628 KB | Output is correct |
40 | Correct | 5 ms | 2756 KB | Output is correct |
41 | Correct | 5 ms | 2904 KB | Output is correct |
42 | Correct | 5 ms | 3008 KB | Output is correct |
43 | Correct | 5 ms | 3124 KB | Output is correct |
44 | Correct | 5 ms | 3264 KB | Output is correct |
45 | Correct | 5 ms | 3392 KB | Output is correct |
46 | Correct | 4 ms | 3524 KB | Output is correct |
47 | Correct | 5 ms | 3652 KB | Output is correct |
48 | Correct | 5 ms | 3780 KB | Output is correct |
49 | Correct | 5 ms | 3912 KB | Output is correct |
50 | Correct | 5 ms | 4036 KB | Output is correct |
51 | Correct | 5 ms | 4164 KB | Output is correct |
52 | Correct | 275 ms | 24516 KB | Output is correct |
53 | Correct | 272 ms | 37252 KB | Output is correct |
54 | Correct | 269 ms | 49896 KB | Output is correct |
55 | Correct | 278 ms | 62596 KB | Output is correct |
56 | Correct | 272 ms | 75196 KB | Output is correct |
57 | Correct | 276 ms | 87920 KB | Output is correct |
58 | Correct | 277 ms | 100740 KB | Output is correct |
59 | Correct | 270 ms | 113252 KB | Output is correct |
60 | Correct | 277 ms | 125964 KB | Output is correct |
61 | Correct | 277 ms | 138512 KB | Output is correct |
62 | Correct | 273 ms | 151228 KB | Output is correct |
63 | Correct | 278 ms | 163960 KB | Output is correct |
64 | Correct | 272 ms | 176640 KB | Output is correct |
65 | Correct | 278 ms | 189196 KB | Output is correct |
66 | Correct | 273 ms | 201872 KB | Output is correct |
67 | Correct | 279 ms | 214648 KB | Output is correct |
68 | Correct | 268 ms | 227196 KB | Output is correct |