답안 #55253

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
55253 2018-07-06T18:07:29 Z shoemakerjo Art Exhibition (JOI18_art) C++14
50 / 100
1000 ms 119448 KB
#include <bits/stdc++.h>

using namespace std;
#define maxn 500010
#define ll long long

map<ll, ll> mp;
int N;
ll a[maxn], b[maxn];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i] >> b[i];
		mp[0-a[i]] += b[i];
	}
	ll ans = 0LL;
	ll cbest = 0;
	ll lastval = 0-mp.begin()->first;
	for (auto it = mp.begin(); it != mp.end(); ++it) {
		ll cspot = 0-it->first;
		ll cnum = it->second;
		// cout << cspot << ": " << cnum << endl;
		cbest = max(cnum, cbest - (lastval - cspot) + cnum);
		ans = max(ans, cbest);
		lastval = cspot;
	}
	cout << ans << endl;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 420 KB Output is correct
4 Correct 2 ms 472 KB Output is correct
5 Correct 2 ms 476 KB Output is correct
6 Correct 2 ms 652 KB Output is correct
7 Correct 2 ms 652 KB Output is correct
8 Correct 2 ms 652 KB Output is correct
9 Correct 2 ms 652 KB Output is correct
10 Correct 3 ms 652 KB Output is correct
11 Correct 2 ms 652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 420 KB Output is correct
4 Correct 2 ms 472 KB Output is correct
5 Correct 2 ms 476 KB Output is correct
6 Correct 2 ms 652 KB Output is correct
7 Correct 2 ms 652 KB Output is correct
8 Correct 2 ms 652 KB Output is correct
9 Correct 2 ms 652 KB Output is correct
10 Correct 3 ms 652 KB Output is correct
11 Correct 2 ms 652 KB Output is correct
12 Correct 3 ms 656 KB Output is correct
13 Correct 2 ms 792 KB Output is correct
14 Correct 2 ms 828 KB Output is correct
15 Correct 2 ms 828 KB Output is correct
16 Correct 3 ms 844 KB Output is correct
17 Correct 2 ms 852 KB Output is correct
18 Correct 2 ms 860 KB Output is correct
19 Correct 3 ms 868 KB Output is correct
20 Correct 3 ms 876 KB Output is correct
21 Correct 2 ms 884 KB Output is correct
22 Correct 2 ms 892 KB Output is correct
23 Correct 3 ms 900 KB Output is correct
24 Correct 2 ms 924 KB Output is correct
25 Correct 3 ms 932 KB Output is correct
26 Correct 3 ms 940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 420 KB Output is correct
4 Correct 2 ms 472 KB Output is correct
5 Correct 2 ms 476 KB Output is correct
6 Correct 2 ms 652 KB Output is correct
7 Correct 2 ms 652 KB Output is correct
8 Correct 2 ms 652 KB Output is correct
9 Correct 2 ms 652 KB Output is correct
10 Correct 3 ms 652 KB Output is correct
11 Correct 2 ms 652 KB Output is correct
12 Correct 3 ms 656 KB Output is correct
13 Correct 2 ms 792 KB Output is correct
14 Correct 2 ms 828 KB Output is correct
15 Correct 2 ms 828 KB Output is correct
16 Correct 3 ms 844 KB Output is correct
17 Correct 2 ms 852 KB Output is correct
18 Correct 2 ms 860 KB Output is correct
19 Correct 3 ms 868 KB Output is correct
20 Correct 3 ms 876 KB Output is correct
21 Correct 2 ms 884 KB Output is correct
22 Correct 2 ms 892 KB Output is correct
23 Correct 3 ms 900 KB Output is correct
24 Correct 2 ms 924 KB Output is correct
25 Correct 3 ms 932 KB Output is correct
26 Correct 3 ms 940 KB Output is correct
27 Correct 7 ms 1480 KB Output is correct
28 Correct 8 ms 1608 KB Output is correct
29 Correct 7 ms 1736 KB Output is correct
30 Correct 6 ms 1864 KB Output is correct
31 Correct 8 ms 2084 KB Output is correct
32 Correct 5 ms 2212 KB Output is correct
33 Correct 6 ms 2248 KB Output is correct
34 Correct 5 ms 2376 KB Output is correct
35 Correct 5 ms 2504 KB Output is correct
36 Correct 6 ms 2728 KB Output is correct
37 Correct 5 ms 2856 KB Output is correct
38 Correct 5 ms 2984 KB Output is correct
39 Correct 6 ms 3112 KB Output is correct
40 Correct 5 ms 3144 KB Output is correct
41 Correct 6 ms 3272 KB Output is correct
42 Correct 5 ms 3396 KB Output is correct
43 Correct 7 ms 3524 KB Output is correct
44 Correct 6 ms 3652 KB Output is correct
45 Correct 6 ms 3780 KB Output is correct
46 Correct 5 ms 3864 KB Output is correct
47 Correct 5 ms 4036 KB Output is correct
48 Correct 6 ms 4164 KB Output is correct
49 Correct 5 ms 4292 KB Output is correct
50 Correct 8 ms 4420 KB Output is correct
51 Correct 6 ms 4552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 420 KB Output is correct
4 Correct 2 ms 472 KB Output is correct
5 Correct 2 ms 476 KB Output is correct
6 Correct 2 ms 652 KB Output is correct
7 Correct 2 ms 652 KB Output is correct
8 Correct 2 ms 652 KB Output is correct
9 Correct 2 ms 652 KB Output is correct
10 Correct 3 ms 652 KB Output is correct
11 Correct 2 ms 652 KB Output is correct
12 Correct 3 ms 656 KB Output is correct
13 Correct 2 ms 792 KB Output is correct
14 Correct 2 ms 828 KB Output is correct
15 Correct 2 ms 828 KB Output is correct
16 Correct 3 ms 844 KB Output is correct
17 Correct 2 ms 852 KB Output is correct
18 Correct 2 ms 860 KB Output is correct
19 Correct 3 ms 868 KB Output is correct
20 Correct 3 ms 876 KB Output is correct
21 Correct 2 ms 884 KB Output is correct
22 Correct 2 ms 892 KB Output is correct
23 Correct 3 ms 900 KB Output is correct
24 Correct 2 ms 924 KB Output is correct
25 Correct 3 ms 932 KB Output is correct
26 Correct 3 ms 940 KB Output is correct
27 Correct 7 ms 1480 KB Output is correct
28 Correct 8 ms 1608 KB Output is correct
29 Correct 7 ms 1736 KB Output is correct
30 Correct 6 ms 1864 KB Output is correct
31 Correct 8 ms 2084 KB Output is correct
32 Correct 5 ms 2212 KB Output is correct
33 Correct 6 ms 2248 KB Output is correct
34 Correct 5 ms 2376 KB Output is correct
35 Correct 5 ms 2504 KB Output is correct
36 Correct 6 ms 2728 KB Output is correct
37 Correct 5 ms 2856 KB Output is correct
38 Correct 5 ms 2984 KB Output is correct
39 Correct 6 ms 3112 KB Output is correct
40 Correct 5 ms 3144 KB Output is correct
41 Correct 6 ms 3272 KB Output is correct
42 Correct 5 ms 3396 KB Output is correct
43 Correct 7 ms 3524 KB Output is correct
44 Correct 6 ms 3652 KB Output is correct
45 Correct 6 ms 3780 KB Output is correct
46 Correct 5 ms 3864 KB Output is correct
47 Correct 5 ms 4036 KB Output is correct
48 Correct 6 ms 4164 KB Output is correct
49 Correct 5 ms 4292 KB Output is correct
50 Correct 8 ms 4420 KB Output is correct
51 Correct 6 ms 4552 KB Output is correct
52 Correct 925 ms 55892 KB Output is correct
53 Correct 706 ms 68652 KB Output is correct
54 Correct 918 ms 81232 KB Output is correct
55 Correct 847 ms 94076 KB Output is correct
56 Correct 754 ms 106544 KB Output is correct
57 Execution timed out 1026 ms 119448 KB Time limit exceeded
58 Halted 0 ms 0 KB -