# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
60402 | 2018-07-24T05:48:32 Z | gusfring | Art Exhibition (JOI18_art) | C++14 | 416 ms | 227264 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int N; pair<ll, ll> a[500005]; int main(){ scanf("%d", &N); for(int i=1; i<=N; ++i) scanf("%lld %lld", &a[i].first, &a[i].second); sort(a + 1, a + N + 1); ll mp = 0, ans = -1000000000000000000LL; for(int i=1; i<=N; ++i){ ans = max(ans, a[i].second + mp); mp = max(0ll, mp + a[i].second - (a[i + 1].first - a[i].first)); } printf("%lld\n", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 356 KB | Output is correct |
3 | Correct | 3 ms | 436 KB | Output is correct |
4 | Correct | 4 ms | 548 KB | Output is correct |
5 | Correct | 3 ms | 548 KB | Output is correct |
6 | Correct | 3 ms | 548 KB | Output is correct |
7 | Correct | 2 ms | 548 KB | Output is correct |
8 | Correct | 2 ms | 548 KB | Output is correct |
9 | Correct | 4 ms | 548 KB | Output is correct |
10 | Correct | 3 ms | 584 KB | Output is correct |
11 | Correct | 3 ms | 608 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 356 KB | Output is correct |
3 | Correct | 3 ms | 436 KB | Output is correct |
4 | Correct | 4 ms | 548 KB | Output is correct |
5 | Correct | 3 ms | 548 KB | Output is correct |
6 | Correct | 3 ms | 548 KB | Output is correct |
7 | Correct | 2 ms | 548 KB | Output is correct |
8 | Correct | 2 ms | 548 KB | Output is correct |
9 | Correct | 4 ms | 548 KB | Output is correct |
10 | Correct | 3 ms | 584 KB | Output is correct |
11 | Correct | 3 ms | 608 KB | Output is correct |
12 | Correct | 3 ms | 660 KB | Output is correct |
13 | Correct | 3 ms | 668 KB | Output is correct |
14 | Correct | 3 ms | 676 KB | Output is correct |
15 | Correct | 3 ms | 684 KB | Output is correct |
16 | Correct | 4 ms | 692 KB | Output is correct |
17 | Correct | 3 ms | 700 KB | Output is correct |
18 | Correct | 4 ms | 828 KB | Output is correct |
19 | Correct | 2 ms | 828 KB | Output is correct |
20 | Correct | 3 ms | 828 KB | Output is correct |
21 | Correct | 3 ms | 828 KB | Output is correct |
22 | Correct | 3 ms | 828 KB | Output is correct |
23 | Correct | 3 ms | 828 KB | Output is correct |
24 | Correct | 3 ms | 828 KB | Output is correct |
25 | Correct | 3 ms | 828 KB | Output is correct |
26 | Correct | 3 ms | 828 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 356 KB | Output is correct |
3 | Correct | 3 ms | 436 KB | Output is correct |
4 | Correct | 4 ms | 548 KB | Output is correct |
5 | Correct | 3 ms | 548 KB | Output is correct |
6 | Correct | 3 ms | 548 KB | Output is correct |
7 | Correct | 2 ms | 548 KB | Output is correct |
8 | Correct | 2 ms | 548 KB | Output is correct |
9 | Correct | 4 ms | 548 KB | Output is correct |
10 | Correct | 3 ms | 584 KB | Output is correct |
11 | Correct | 3 ms | 608 KB | Output is correct |
12 | Correct | 3 ms | 660 KB | Output is correct |
13 | Correct | 3 ms | 668 KB | Output is correct |
14 | Correct | 3 ms | 676 KB | Output is correct |
15 | Correct | 3 ms | 684 KB | Output is correct |
16 | Correct | 4 ms | 692 KB | Output is correct |
17 | Correct | 3 ms | 700 KB | Output is correct |
18 | Correct | 4 ms | 828 KB | Output is correct |
19 | Correct | 2 ms | 828 KB | Output is correct |
20 | Correct | 3 ms | 828 KB | Output is correct |
21 | Correct | 3 ms | 828 KB | Output is correct |
22 | Correct | 3 ms | 828 KB | Output is correct |
23 | Correct | 3 ms | 828 KB | Output is correct |
24 | Correct | 3 ms | 828 KB | Output is correct |
25 | Correct | 3 ms | 828 KB | Output is correct |
26 | Correct | 3 ms | 828 KB | Output is correct |
27 | Correct | 5 ms | 908 KB | Output is correct |
28 | Correct | 5 ms | 1036 KB | Output is correct |
29 | Correct | 7 ms | 1164 KB | Output is correct |
30 | Correct | 7 ms | 1292 KB | Output is correct |
31 | Correct | 7 ms | 1412 KB | Output is correct |
32 | Correct | 7 ms | 1548 KB | Output is correct |
33 | Correct | 6 ms | 1676 KB | Output is correct |
34 | Correct | 7 ms | 1804 KB | Output is correct |
35 | Correct | 7 ms | 1984 KB | Output is correct |
36 | Correct | 5 ms | 2032 KB | Output is correct |
37 | Correct | 6 ms | 2316 KB | Output is correct |
38 | Correct | 6 ms | 2384 KB | Output is correct |
39 | Correct | 6 ms | 2460 KB | Output is correct |
40 | Correct | 7 ms | 2588 KB | Output is correct |
41 | Correct | 7 ms | 2716 KB | Output is correct |
42 | Correct | 6 ms | 2840 KB | Output is correct |
43 | Correct | 8 ms | 2968 KB | Output is correct |
44 | Correct | 5 ms | 3096 KB | Output is correct |
45 | Correct | 7 ms | 3224 KB | Output is correct |
46 | Correct | 7 ms | 3352 KB | Output is correct |
47 | Correct | 5 ms | 3480 KB | Output is correct |
48 | Correct | 5 ms | 3608 KB | Output is correct |
49 | Correct | 9 ms | 3864 KB | Output is correct |
50 | Correct | 5 ms | 3868 KB | Output is correct |
51 | Correct | 6 ms | 3992 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 356 KB | Output is correct |
3 | Correct | 3 ms | 436 KB | Output is correct |
4 | Correct | 4 ms | 548 KB | Output is correct |
5 | Correct | 3 ms | 548 KB | Output is correct |
6 | Correct | 3 ms | 548 KB | Output is correct |
7 | Correct | 2 ms | 548 KB | Output is correct |
8 | Correct | 2 ms | 548 KB | Output is correct |
9 | Correct | 4 ms | 548 KB | Output is correct |
10 | Correct | 3 ms | 584 KB | Output is correct |
11 | Correct | 3 ms | 608 KB | Output is correct |
12 | Correct | 3 ms | 660 KB | Output is correct |
13 | Correct | 3 ms | 668 KB | Output is correct |
14 | Correct | 3 ms | 676 KB | Output is correct |
15 | Correct | 3 ms | 684 KB | Output is correct |
16 | Correct | 4 ms | 692 KB | Output is correct |
17 | Correct | 3 ms | 700 KB | Output is correct |
18 | Correct | 4 ms | 828 KB | Output is correct |
19 | Correct | 2 ms | 828 KB | Output is correct |
20 | Correct | 3 ms | 828 KB | Output is correct |
21 | Correct | 3 ms | 828 KB | Output is correct |
22 | Correct | 3 ms | 828 KB | Output is correct |
23 | Correct | 3 ms | 828 KB | Output is correct |
24 | Correct | 3 ms | 828 KB | Output is correct |
25 | Correct | 3 ms | 828 KB | Output is correct |
26 | Correct | 3 ms | 828 KB | Output is correct |
27 | Correct | 5 ms | 908 KB | Output is correct |
28 | Correct | 5 ms | 1036 KB | Output is correct |
29 | Correct | 7 ms | 1164 KB | Output is correct |
30 | Correct | 7 ms | 1292 KB | Output is correct |
31 | Correct | 7 ms | 1412 KB | Output is correct |
32 | Correct | 7 ms | 1548 KB | Output is correct |
33 | Correct | 6 ms | 1676 KB | Output is correct |
34 | Correct | 7 ms | 1804 KB | Output is correct |
35 | Correct | 7 ms | 1984 KB | Output is correct |
36 | Correct | 5 ms | 2032 KB | Output is correct |
37 | Correct | 6 ms | 2316 KB | Output is correct |
38 | Correct | 6 ms | 2384 KB | Output is correct |
39 | Correct | 6 ms | 2460 KB | Output is correct |
40 | Correct | 7 ms | 2588 KB | Output is correct |
41 | Correct | 7 ms | 2716 KB | Output is correct |
42 | Correct | 6 ms | 2840 KB | Output is correct |
43 | Correct | 8 ms | 2968 KB | Output is correct |
44 | Correct | 5 ms | 3096 KB | Output is correct |
45 | Correct | 7 ms | 3224 KB | Output is correct |
46 | Correct | 7 ms | 3352 KB | Output is correct |
47 | Correct | 5 ms | 3480 KB | Output is correct |
48 | Correct | 5 ms | 3608 KB | Output is correct |
49 | Correct | 9 ms | 3864 KB | Output is correct |
50 | Correct | 5 ms | 3868 KB | Output is correct |
51 | Correct | 6 ms | 3992 KB | Output is correct |
52 | Correct | 347 ms | 24556 KB | Output is correct |
53 | Correct | 319 ms | 37252 KB | Output is correct |
54 | Correct | 313 ms | 49856 KB | Output is correct |
55 | Correct | 358 ms | 62664 KB | Output is correct |
56 | Correct | 349 ms | 75264 KB | Output is correct |
57 | Correct | 314 ms | 87876 KB | Output is correct |
58 | Correct | 334 ms | 100632 KB | Output is correct |
59 | Correct | 359 ms | 113332 KB | Output is correct |
60 | Correct | 344 ms | 125996 KB | Output is correct |
61 | Correct | 379 ms | 138544 KB | Output is correct |
62 | Correct | 416 ms | 151264 KB | Output is correct |
63 | Correct | 414 ms | 163828 KB | Output is correct |
64 | Correct | 376 ms | 176480 KB | Output is correct |
65 | Correct | 311 ms | 189140 KB | Output is correct |
66 | Correct | 306 ms | 201820 KB | Output is correct |
67 | Correct | 332 ms | 214520 KB | Output is correct |
68 | Correct | 342 ms | 227264 KB | Output is correct |