답안 #86848

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
86848 2018-11-27T19:59:08 Z KCSC Art Exhibition (JOI18_art) C++14
100 / 100
691 ms 68556 KB
#include <bits/stdc++.h>
using namespace std;

// psm[i] - psm[j - 1] - (arr[i] - arr[j])
// psm[i] - arr[i] - (-arr[j] + psm[j - 1])

const int DIM = 500005;

pair<long long, long long> arr[DIM];

int main(void) {
#ifdef HOME
	freopen("art.in", "r", stdin);
	freopen("art.out", "w", stdout);
#endif
	int n; cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> arr[i].first >> arr[i].second; }
	sort(arr + 1, arr + n + 1);
	long long mn = 1LL << 60, mx = -1LL << 60;
	for (int i = 1; i <= n; ++i) {
		arr[i].second += arr[i - 1].second;
		mn = min(mn, -arr[i].first + arr[i - 1].second);
		mx = max(mx, arr[i].second - arr[i].first - mn); }
	cout << mx;
	return 0; }
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 508 KB Output is correct
4 Correct 2 ms 508 KB Output is correct
5 Correct 2 ms 508 KB Output is correct
6 Correct 2 ms 524 KB Output is correct
7 Correct 2 ms 572 KB Output is correct
8 Correct 2 ms 572 KB Output is correct
9 Correct 2 ms 580 KB Output is correct
10 Correct 2 ms 584 KB Output is correct
11 Correct 2 ms 584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 508 KB Output is correct
4 Correct 2 ms 508 KB Output is correct
5 Correct 2 ms 508 KB Output is correct
6 Correct 2 ms 524 KB Output is correct
7 Correct 2 ms 572 KB Output is correct
8 Correct 2 ms 572 KB Output is correct
9 Correct 2 ms 580 KB Output is correct
10 Correct 2 ms 584 KB Output is correct
11 Correct 2 ms 584 KB Output is correct
12 Correct 3 ms 592 KB Output is correct
13 Correct 3 ms 604 KB Output is correct
14 Correct 2 ms 612 KB Output is correct
15 Correct 2 ms 612 KB Output is correct
16 Correct 3 ms 768 KB Output is correct
17 Correct 3 ms 768 KB Output is correct
18 Correct 2 ms 768 KB Output is correct
19 Correct 2 ms 768 KB Output is correct
20 Correct 2 ms 768 KB Output is correct
21 Correct 3 ms 768 KB Output is correct
22 Correct 2 ms 768 KB Output is correct
23 Correct 2 ms 768 KB Output is correct
24 Correct 3 ms 780 KB Output is correct
25 Correct 2 ms 784 KB Output is correct
26 Correct 2 ms 792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 508 KB Output is correct
4 Correct 2 ms 508 KB Output is correct
5 Correct 2 ms 508 KB Output is correct
6 Correct 2 ms 524 KB Output is correct
7 Correct 2 ms 572 KB Output is correct
8 Correct 2 ms 572 KB Output is correct
9 Correct 2 ms 580 KB Output is correct
10 Correct 2 ms 584 KB Output is correct
11 Correct 2 ms 584 KB Output is correct
12 Correct 3 ms 592 KB Output is correct
13 Correct 3 ms 604 KB Output is correct
14 Correct 2 ms 612 KB Output is correct
15 Correct 2 ms 612 KB Output is correct
16 Correct 3 ms 768 KB Output is correct
17 Correct 3 ms 768 KB Output is correct
18 Correct 2 ms 768 KB Output is correct
19 Correct 2 ms 768 KB Output is correct
20 Correct 2 ms 768 KB Output is correct
21 Correct 3 ms 768 KB Output is correct
22 Correct 2 ms 768 KB Output is correct
23 Correct 2 ms 768 KB Output is correct
24 Correct 3 ms 780 KB Output is correct
25 Correct 2 ms 784 KB Output is correct
26 Correct 2 ms 792 KB Output is correct
27 Correct 9 ms 1044 KB Output is correct
28 Correct 10 ms 1056 KB Output is correct
29 Correct 9 ms 1228 KB Output is correct
30 Correct 9 ms 1300 KB Output is correct
31 Correct 10 ms 1428 KB Output is correct
32 Correct 9 ms 1556 KB Output is correct
33 Correct 10 ms 1684 KB Output is correct
34 Correct 9 ms 1812 KB Output is correct
35 Correct 8 ms 1940 KB Output is correct
36 Correct 9 ms 2068 KB Output is correct
37 Correct 8 ms 2196 KB Output is correct
38 Correct 9 ms 2324 KB Output is correct
39 Correct 9 ms 2504 KB Output is correct
40 Correct 9 ms 2580 KB Output is correct
41 Correct 9 ms 2712 KB Output is correct
42 Correct 8 ms 2836 KB Output is correct
43 Correct 9 ms 3092 KB Output is correct
44 Correct 8 ms 3092 KB Output is correct
45 Correct 9 ms 3220 KB Output is correct
46 Correct 13 ms 3348 KB Output is correct
47 Correct 9 ms 3476 KB Output is correct
48 Correct 8 ms 3604 KB Output is correct
49 Correct 8 ms 3732 KB Output is correct
50 Correct 8 ms 3864 KB Output is correct
51 Correct 8 ms 3988 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 508 KB Output is correct
4 Correct 2 ms 508 KB Output is correct
5 Correct 2 ms 508 KB Output is correct
6 Correct 2 ms 524 KB Output is correct
7 Correct 2 ms 572 KB Output is correct
8 Correct 2 ms 572 KB Output is correct
9 Correct 2 ms 580 KB Output is correct
10 Correct 2 ms 584 KB Output is correct
11 Correct 2 ms 584 KB Output is correct
12 Correct 3 ms 592 KB Output is correct
13 Correct 3 ms 604 KB Output is correct
14 Correct 2 ms 612 KB Output is correct
15 Correct 2 ms 612 KB Output is correct
16 Correct 3 ms 768 KB Output is correct
17 Correct 3 ms 768 KB Output is correct
18 Correct 2 ms 768 KB Output is correct
19 Correct 2 ms 768 KB Output is correct
20 Correct 2 ms 768 KB Output is correct
21 Correct 3 ms 768 KB Output is correct
22 Correct 2 ms 768 KB Output is correct
23 Correct 2 ms 768 KB Output is correct
24 Correct 3 ms 780 KB Output is correct
25 Correct 2 ms 784 KB Output is correct
26 Correct 2 ms 792 KB Output is correct
27 Correct 9 ms 1044 KB Output is correct
28 Correct 10 ms 1056 KB Output is correct
29 Correct 9 ms 1228 KB Output is correct
30 Correct 9 ms 1300 KB Output is correct
31 Correct 10 ms 1428 KB Output is correct
32 Correct 9 ms 1556 KB Output is correct
33 Correct 10 ms 1684 KB Output is correct
34 Correct 9 ms 1812 KB Output is correct
35 Correct 8 ms 1940 KB Output is correct
36 Correct 9 ms 2068 KB Output is correct
37 Correct 8 ms 2196 KB Output is correct
38 Correct 9 ms 2324 KB Output is correct
39 Correct 9 ms 2504 KB Output is correct
40 Correct 9 ms 2580 KB Output is correct
41 Correct 9 ms 2712 KB Output is correct
42 Correct 8 ms 2836 KB Output is correct
43 Correct 9 ms 3092 KB Output is correct
44 Correct 8 ms 3092 KB Output is correct
45 Correct 9 ms 3220 KB Output is correct
46 Correct 13 ms 3348 KB Output is correct
47 Correct 9 ms 3476 KB Output is correct
48 Correct 8 ms 3604 KB Output is correct
49 Correct 8 ms 3732 KB Output is correct
50 Correct 8 ms 3864 KB Output is correct
51 Correct 8 ms 3988 KB Output is correct
52 Correct 654 ms 24464 KB Output is correct
53 Correct 663 ms 30832 KB Output is correct
54 Correct 688 ms 31552 KB Output is correct
55 Correct 659 ms 44240 KB Output is correct
56 Correct 648 ms 56808 KB Output is correct
57 Correct 639 ms 68344 KB Output is correct
58 Correct 644 ms 68440 KB Output is correct
59 Correct 644 ms 68440 KB Output is correct
60 Correct 663 ms 68440 KB Output is correct
61 Correct 666 ms 68556 KB Output is correct
62 Correct 642 ms 68556 KB Output is correct
63 Correct 662 ms 68556 KB Output is correct
64 Correct 659 ms 68556 KB Output is correct
65 Correct 691 ms 68556 KB Output is correct
66 Correct 645 ms 68556 KB Output is correct
67 Correct 635 ms 68556 KB Output is correct
68 Correct 633 ms 68556 KB Output is correct