# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
62225 | 2018-07-27T22:21:56 Z | kingpig9 | Art Exhibition (JOI18_art) | C++11 | 348 ms | 115196 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; const int MAXN = 500010; #define debug(...) fprintf(stderr, __VA_ARGS__) #define fi first #define se second #define all(v) (v).begin(), (v).end() #define fillchar(a, s) memset((a), (s), sizeof(a)) void setmax (ll &a, ll b) { if (a < b) { a = b; } } int N; pll P[MAXN]; ll V[MAXN]; int main() { scanf("%d", &N); for (int i = 1; i <= N; i++) { scanf("%lld %lld", &P[i].fi, &P[i].se); } sort(P + 1, P + N + 1); for (int i = N; i >= 1; i--) { P[i].fi -= P[i - 1].fi; } for (int i = 1; i <= N; i++) { V[i] = V[i - 1] - P[i].fi + P[i].se; } ll ans = LLONG_MIN; ll suffmx = LLONG_MIN; for (int i = N; i >= 1; i--) { setmax(suffmx, V[i]); setmax(ans, suffmx - V[i] + P[i].se); } printf("%lld\n", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 464 KB | Output is correct |
3 | Correct | 2 ms | 476 KB | Output is correct |
4 | Correct | 2 ms | 580 KB | Output is correct |
5 | Correct | 3 ms | 580 KB | Output is correct |
6 | Correct | 3 ms | 588 KB | Output is correct |
7 | Correct | 3 ms | 592 KB | Output is correct |
8 | Correct | 3 ms | 608 KB | Output is correct |
9 | Correct | 3 ms | 620 KB | Output is correct |
10 | Correct | 3 ms | 628 KB | Output is correct |
11 | Correct | 3 ms | 632 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 464 KB | Output is correct |
3 | Correct | 2 ms | 476 KB | Output is correct |
4 | Correct | 2 ms | 580 KB | Output is correct |
5 | Correct | 3 ms | 580 KB | Output is correct |
6 | Correct | 3 ms | 588 KB | Output is correct |
7 | Correct | 3 ms | 592 KB | Output is correct |
8 | Correct | 3 ms | 608 KB | Output is correct |
9 | Correct | 3 ms | 620 KB | Output is correct |
10 | Correct | 3 ms | 628 KB | Output is correct |
11 | Correct | 3 ms | 632 KB | Output is correct |
12 | Correct | 2 ms | 632 KB | Output is correct |
13 | Correct | 3 ms | 644 KB | Output is correct |
14 | Correct | 3 ms | 652 KB | Output is correct |
15 | Correct | 3 ms | 660 KB | Output is correct |
16 | Correct | 2 ms | 668 KB | Output is correct |
17 | Correct | 4 ms | 676 KB | Output is correct |
18 | Correct | 2 ms | 684 KB | Output is correct |
19 | Correct | 4 ms | 692 KB | Output is correct |
20 | Correct | 4 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 | 2 ms | 828 KB | Output is correct |
25 | Correct | 3 ms | 828 KB | Output is correct |
26 | Correct | 2 ms | 828 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 464 KB | Output is correct |
3 | Correct | 2 ms | 476 KB | Output is correct |
4 | Correct | 2 ms | 580 KB | Output is correct |
5 | Correct | 3 ms | 580 KB | Output is correct |
6 | Correct | 3 ms | 588 KB | Output is correct |
7 | Correct | 3 ms | 592 KB | Output is correct |
8 | Correct | 3 ms | 608 KB | Output is correct |
9 | Correct | 3 ms | 620 KB | Output is correct |
10 | Correct | 3 ms | 628 KB | Output is correct |
11 | Correct | 3 ms | 632 KB | Output is correct |
12 | Correct | 2 ms | 632 KB | Output is correct |
13 | Correct | 3 ms | 644 KB | Output is correct |
14 | Correct | 3 ms | 652 KB | Output is correct |
15 | Correct | 3 ms | 660 KB | Output is correct |
16 | Correct | 2 ms | 668 KB | Output is correct |
17 | Correct | 4 ms | 676 KB | Output is correct |
18 | Correct | 2 ms | 684 KB | Output is correct |
19 | Correct | 4 ms | 692 KB | Output is correct |
20 | Correct | 4 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 | 2 ms | 828 KB | Output is correct |
25 | Correct | 3 ms | 828 KB | Output is correct |
26 | Correct | 2 ms | 828 KB | Output is correct |
27 | Correct | 6 ms | 900 KB | Output is correct |
28 | Correct | 7 ms | 1028 KB | Output is correct |
29 | Correct | 5 ms | 1156 KB | Output is correct |
30 | Correct | 6 ms | 1300 KB | Output is correct |
31 | Correct | 5 ms | 1424 KB | Output is correct |
32 | Correct | 5 ms | 1564 KB | Output is correct |
33 | Correct | 6 ms | 1668 KB | Output is correct |
34 | Correct | 6 ms | 1924 KB | Output is correct |
35 | Correct | 6 ms | 1928 KB | Output is correct |
36 | Correct | 6 ms | 2052 KB | Output is correct |
37 | Correct | 7 ms | 2180 KB | Output is correct |
38 | Correct | 7 ms | 2308 KB | Output is correct |
39 | Correct | 6 ms | 2448 KB | Output is correct |
40 | Correct | 9 ms | 2584 KB | Output is correct |
41 | Correct | 7 ms | 2692 KB | Output is correct |
42 | Correct | 8 ms | 2816 KB | Output is correct |
43 | Correct | 8 ms | 2944 KB | Output is correct |
44 | Correct | 6 ms | 3200 KB | Output is correct |
45 | Correct | 6 ms | 3200 KB | Output is correct |
46 | Correct | 7 ms | 3328 KB | Output is correct |
47 | Correct | 6 ms | 3464 KB | Output is correct |
48 | Correct | 5 ms | 3604 KB | Output is correct |
49 | Correct | 6 ms | 3712 KB | Output is correct |
50 | Correct | 6 ms | 3840 KB | Output is correct |
51 | Correct | 6 ms | 3968 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 464 KB | Output is correct |
3 | Correct | 2 ms | 476 KB | Output is correct |
4 | Correct | 2 ms | 580 KB | Output is correct |
5 | Correct | 3 ms | 580 KB | Output is correct |
6 | Correct | 3 ms | 588 KB | Output is correct |
7 | Correct | 3 ms | 592 KB | Output is correct |
8 | Correct | 3 ms | 608 KB | Output is correct |
9 | Correct | 3 ms | 620 KB | Output is correct |
10 | Correct | 3 ms | 628 KB | Output is correct |
11 | Correct | 3 ms | 632 KB | Output is correct |
12 | Correct | 2 ms | 632 KB | Output is correct |
13 | Correct | 3 ms | 644 KB | Output is correct |
14 | Correct | 3 ms | 652 KB | Output is correct |
15 | Correct | 3 ms | 660 KB | Output is correct |
16 | Correct | 2 ms | 668 KB | Output is correct |
17 | Correct | 4 ms | 676 KB | Output is correct |
18 | Correct | 2 ms | 684 KB | Output is correct |
19 | Correct | 4 ms | 692 KB | Output is correct |
20 | Correct | 4 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 | 2 ms | 828 KB | Output is correct |
25 | Correct | 3 ms | 828 KB | Output is correct |
26 | Correct | 2 ms | 828 KB | Output is correct |
27 | Correct | 6 ms | 900 KB | Output is correct |
28 | Correct | 7 ms | 1028 KB | Output is correct |
29 | Correct | 5 ms | 1156 KB | Output is correct |
30 | Correct | 6 ms | 1300 KB | Output is correct |
31 | Correct | 5 ms | 1424 KB | Output is correct |
32 | Correct | 5 ms | 1564 KB | Output is correct |
33 | Correct | 6 ms | 1668 KB | Output is correct |
34 | Correct | 6 ms | 1924 KB | Output is correct |
35 | Correct | 6 ms | 1928 KB | Output is correct |
36 | Correct | 6 ms | 2052 KB | Output is correct |
37 | Correct | 7 ms | 2180 KB | Output is correct |
38 | Correct | 7 ms | 2308 KB | Output is correct |
39 | Correct | 6 ms | 2448 KB | Output is correct |
40 | Correct | 9 ms | 2584 KB | Output is correct |
41 | Correct | 7 ms | 2692 KB | Output is correct |
42 | Correct | 8 ms | 2816 KB | Output is correct |
43 | Correct | 8 ms | 2944 KB | Output is correct |
44 | Correct | 6 ms | 3200 KB | Output is correct |
45 | Correct | 6 ms | 3200 KB | Output is correct |
46 | Correct | 7 ms | 3328 KB | Output is correct |
47 | Correct | 6 ms | 3464 KB | Output is correct |
48 | Correct | 5 ms | 3604 KB | Output is correct |
49 | Correct | 6 ms | 3712 KB | Output is correct |
50 | Correct | 6 ms | 3840 KB | Output is correct |
51 | Correct | 6 ms | 3968 KB | Output is correct |
52 | Correct | 343 ms | 28268 KB | Output is correct |
53 | Correct | 301 ms | 40916 KB | Output is correct |
54 | Correct | 295 ms | 53656 KB | Output is correct |
55 | Correct | 288 ms | 66384 KB | Output is correct |
56 | Correct | 282 ms | 78936 KB | Output is correct |
57 | Correct | 285 ms | 91452 KB | Output is correct |
58 | Correct | 348 ms | 104224 KB | Output is correct |
59 | Correct | 303 ms | 115028 KB | Output is correct |
60 | Correct | 298 ms | 115196 KB | Output is correct |
61 | Correct | 290 ms | 115196 KB | Output is correct |
62 | Correct | 320 ms | 115196 KB | Output is correct |
63 | Correct | 333 ms | 115196 KB | Output is correct |
64 | Correct | 289 ms | 115196 KB | Output is correct |
65 | Correct | 344 ms | 115196 KB | Output is correct |
66 | Correct | 324 ms | 115196 KB | Output is correct |
67 | Correct | 304 ms | 115196 KB | Output is correct |
68 | Correct | 306 ms | 115196 KB | Output is correct |