# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
71442 | 2018-08-24T16:29:13 Z | win11905 | Art Exhibition (JOI18_art) | C++11 | 352 ms | 227308 KB |
#include <bits/stdc++.h> using namespace std; #define long long long #define pll pair<long, long> #define x first #define y second int n; long pref, ans, lhs = -1e18; int main() { scanf("%d", &n); vector<pll> V; for(int i = 0; i < n; ++i) { long a, b; scanf("%lld %lld", &a, &b); V.emplace_back(a, b); } sort(V.begin(), V.end()); for(int i = 0; i < n; ++i) { long a, b; tie(a, b) = V[i]; lhs = max(lhs, a - pref); pref += b; ans = max(ans, pref - a + lhs); } printf("%lld\n", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 4 ms | 484 KB | Output is correct |
3 | Correct | 3 ms | 484 KB | Output is correct |
4 | Correct | 3 ms | 768 KB | Output is correct |
5 | Correct | 2 ms | 768 KB | Output is correct |
6 | Correct | 3 ms | 768 KB | Output is correct |
7 | Correct | 2 ms | 768 KB | Output is correct |
8 | Correct | 2 ms | 768 KB | Output is correct |
9 | Correct | 2 ms | 768 KB | Output is correct |
10 | Correct | 3 ms | 768 KB | Output is correct |
11 | Correct | 3 ms | 768 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 4 ms | 484 KB | Output is correct |
3 | Correct | 3 ms | 484 KB | Output is correct |
4 | Correct | 3 ms | 768 KB | Output is correct |
5 | Correct | 2 ms | 768 KB | Output is correct |
6 | Correct | 3 ms | 768 KB | Output is correct |
7 | Correct | 2 ms | 768 KB | Output is correct |
8 | Correct | 2 ms | 768 KB | Output is correct |
9 | Correct | 2 ms | 768 KB | Output is correct |
10 | Correct | 3 ms | 768 KB | Output is correct |
11 | Correct | 3 ms | 768 KB | Output is correct |
12 | Correct | 2 ms | 768 KB | Output is correct |
13 | Correct | 3 ms | 768 KB | Output is correct |
14 | Correct | 3 ms | 768 KB | Output is correct |
15 | Correct | 2 ms | 768 KB | Output is correct |
16 | Correct | 3 ms | 780 KB | Output is correct |
17 | Correct | 4 ms | 796 KB | Output is correct |
18 | Correct | 3 ms | 860 KB | Output is correct |
19 | Correct | 3 ms | 868 KB | Output is correct |
20 | Correct | 3 ms | 868 KB | Output is correct |
21 | Correct | 3 ms | 988 KB | Output is correct |
22 | Correct | 3 ms | 1000 KB | Output is correct |
23 | Correct | 3 ms | 1000 KB | Output is correct |
24 | Correct | 3 ms | 1000 KB | Output is correct |
25 | Correct | 2 ms | 1000 KB | Output is correct |
26 | Correct | 2 ms | 1000 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 4 ms | 484 KB | Output is correct |
3 | Correct | 3 ms | 484 KB | Output is correct |
4 | Correct | 3 ms | 768 KB | Output is correct |
5 | Correct | 2 ms | 768 KB | Output is correct |
6 | Correct | 3 ms | 768 KB | Output is correct |
7 | Correct | 2 ms | 768 KB | Output is correct |
8 | Correct | 2 ms | 768 KB | Output is correct |
9 | Correct | 2 ms | 768 KB | Output is correct |
10 | Correct | 3 ms | 768 KB | Output is correct |
11 | Correct | 3 ms | 768 KB | Output is correct |
12 | Correct | 2 ms | 768 KB | Output is correct |
13 | Correct | 3 ms | 768 KB | Output is correct |
14 | Correct | 3 ms | 768 KB | Output is correct |
15 | Correct | 2 ms | 768 KB | Output is correct |
16 | Correct | 3 ms | 780 KB | Output is correct |
17 | Correct | 4 ms | 796 KB | Output is correct |
18 | Correct | 3 ms | 860 KB | Output is correct |
19 | Correct | 3 ms | 868 KB | Output is correct |
20 | Correct | 3 ms | 868 KB | Output is correct |
21 | Correct | 3 ms | 988 KB | Output is correct |
22 | Correct | 3 ms | 1000 KB | Output is correct |
23 | Correct | 3 ms | 1000 KB | Output is correct |
24 | Correct | 3 ms | 1000 KB | Output is correct |
25 | Correct | 2 ms | 1000 KB | Output is correct |
26 | Correct | 2 ms | 1000 KB | Output is correct |
27 | Correct | 5 ms | 1208 KB | Output is correct |
28 | Correct | 8 ms | 1336 KB | Output is correct |
29 | Correct | 6 ms | 1512 KB | Output is correct |
30 | Correct | 6 ms | 1640 KB | Output is correct |
31 | Correct | 7 ms | 1768 KB | Output is correct |
32 | Correct | 6 ms | 1848 KB | Output is correct |
33 | Correct | 7 ms | 1976 KB | Output is correct |
34 | Correct | 6 ms | 2156 KB | Output is correct |
35 | Correct | 6 ms | 2232 KB | Output is correct |
36 | Correct | 6 ms | 2360 KB | Output is correct |
37 | Correct | 7 ms | 2488 KB | Output is correct |
38 | Correct | 6 ms | 2616 KB | Output is correct |
39 | Correct | 6 ms | 2872 KB | Output is correct |
40 | Correct | 7 ms | 2956 KB | Output is correct |
41 | Correct | 7 ms | 3000 KB | Output is correct |
42 | Correct | 6 ms | 3128 KB | Output is correct |
43 | Correct | 7 ms | 3252 KB | Output is correct |
44 | Correct | 5 ms | 3380 KB | Output is correct |
45 | Correct | 8 ms | 3508 KB | Output is correct |
46 | Correct | 5 ms | 3636 KB | Output is correct |
47 | Correct | 6 ms | 3812 KB | Output is correct |
48 | Correct | 6 ms | 3868 KB | Output is correct |
49 | Correct | 6 ms | 4044 KB | Output is correct |
50 | Correct | 6 ms | 4148 KB | Output is correct |
51 | Correct | 7 ms | 4324 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 4 ms | 484 KB | Output is correct |
3 | Correct | 3 ms | 484 KB | Output is correct |
4 | Correct | 3 ms | 768 KB | Output is correct |
5 | Correct | 2 ms | 768 KB | Output is correct |
6 | Correct | 3 ms | 768 KB | Output is correct |
7 | Correct | 2 ms | 768 KB | Output is correct |
8 | Correct | 2 ms | 768 KB | Output is correct |
9 | Correct | 2 ms | 768 KB | Output is correct |
10 | Correct | 3 ms | 768 KB | Output is correct |
11 | Correct | 3 ms | 768 KB | Output is correct |
12 | Correct | 2 ms | 768 KB | Output is correct |
13 | Correct | 3 ms | 768 KB | Output is correct |
14 | Correct | 3 ms | 768 KB | Output is correct |
15 | Correct | 2 ms | 768 KB | Output is correct |
16 | Correct | 3 ms | 780 KB | Output is correct |
17 | Correct | 4 ms | 796 KB | Output is correct |
18 | Correct | 3 ms | 860 KB | Output is correct |
19 | Correct | 3 ms | 868 KB | Output is correct |
20 | Correct | 3 ms | 868 KB | Output is correct |
21 | Correct | 3 ms | 988 KB | Output is correct |
22 | Correct | 3 ms | 1000 KB | Output is correct |
23 | Correct | 3 ms | 1000 KB | Output is correct |
24 | Correct | 3 ms | 1000 KB | Output is correct |
25 | Correct | 2 ms | 1000 KB | Output is correct |
26 | Correct | 2 ms | 1000 KB | Output is correct |
27 | Correct | 5 ms | 1208 KB | Output is correct |
28 | Correct | 8 ms | 1336 KB | Output is correct |
29 | Correct | 6 ms | 1512 KB | Output is correct |
30 | Correct | 6 ms | 1640 KB | Output is correct |
31 | Correct | 7 ms | 1768 KB | Output is correct |
32 | Correct | 6 ms | 1848 KB | Output is correct |
33 | Correct | 7 ms | 1976 KB | Output is correct |
34 | Correct | 6 ms | 2156 KB | Output is correct |
35 | Correct | 6 ms | 2232 KB | Output is correct |
36 | Correct | 6 ms | 2360 KB | Output is correct |
37 | Correct | 7 ms | 2488 KB | Output is correct |
38 | Correct | 6 ms | 2616 KB | Output is correct |
39 | Correct | 6 ms | 2872 KB | Output is correct |
40 | Correct | 7 ms | 2956 KB | Output is correct |
41 | Correct | 7 ms | 3000 KB | Output is correct |
42 | Correct | 6 ms | 3128 KB | Output is correct |
43 | Correct | 7 ms | 3252 KB | Output is correct |
44 | Correct | 5 ms | 3380 KB | Output is correct |
45 | Correct | 8 ms | 3508 KB | Output is correct |
46 | Correct | 5 ms | 3636 KB | Output is correct |
47 | Correct | 6 ms | 3812 KB | Output is correct |
48 | Correct | 6 ms | 3868 KB | Output is correct |
49 | Correct | 6 ms | 4044 KB | Output is correct |
50 | Correct | 6 ms | 4148 KB | Output is correct |
51 | Correct | 7 ms | 4324 KB | Output is correct |
52 | Correct | 304 ms | 24872 KB | Output is correct |
53 | Correct | 352 ms | 37456 KB | Output is correct |
54 | Correct | 303 ms | 50012 KB | Output is correct |
55 | Correct | 317 ms | 62628 KB | Output is correct |
56 | Correct | 316 ms | 75492 KB | Output is correct |
57 | Correct | 297 ms | 88028 KB | Output is correct |
58 | Correct | 273 ms | 100700 KB | Output is correct |
59 | Correct | 309 ms | 113376 KB | Output is correct |
60 | Correct | 301 ms | 126036 KB | Output is correct |
61 | Correct | 276 ms | 138524 KB | Output is correct |
62 | Correct | 283 ms | 151244 KB | Output is correct |
63 | Correct | 281 ms | 163920 KB | Output is correct |
64 | Correct | 315 ms | 176724 KB | Output is correct |
65 | Correct | 348 ms | 189272 KB | Output is correct |
66 | Correct | 297 ms | 201988 KB | Output is correct |
67 | Correct | 336 ms | 214620 KB | Output is correct |
68 | Correct | 275 ms | 227308 KB | Output is correct |