# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
772404 | 2023-07-04T05:37:32 Z | RecursiveCo | Art Exhibition (JOI18_art) | C++14 | 181 ms | 28832 KB |
// CF template, version 3.0 #include <bits/stdc++.h> using namespace std; #define improvePerformance ios_base::sync_with_stdio(false); cin.tie(0) #define getTest int t; cin >> t #define eachTest for (int _var=0;_var<t;_var++) #define get(name) int (name); cin >> (name) #define out(o) cout << (o) #define getList(cnt, name) vector<int> (name); for (int _=0;_<(cnt);_++) { get(a); (name).push_back(a); } #define sortl(name) sort((name).begin(), (name).end()) #define rev(name) reverse((name).begin(), (name).end()) #define forto(name, var) for (int (var) = 0; (var) < (name); (var)++) #define decision(b) if (b){out("YES");}else{out("NO");} #define int long long int signed main() { improvePerformance; get(n); vector<pair<int, int>> art; forto(n, i) { get(a); get(b); art.push_back({a, b}); } sortl(art); vector<int> values; forto(n, i) values.push_back(art[i].first + art[i].second - (i == n - 1? 0: art[i + 1].first)); int maxsub = values[0]; int ans = art[0].second; for (int i = 1; i < n; i++) { maxsub = max(0ll, maxsub) + values[i]; ans = max(ans, maxsub - art[i].first + (i == n - 1? 0: art[i + 1].first)); } out(ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 320 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 320 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 320 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 320 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 320 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 320 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 328 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 324 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 328 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 324 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 320 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 320 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 320 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 328 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 324 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 328 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 324 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 340 KB | Output is correct |
27 | Correct | 2 ms | 680 KB | Output is correct |
28 | Correct | 2 ms | 596 KB | Output is correct |
29 | Correct | 2 ms | 596 KB | Output is correct |
30 | Correct | 2 ms | 596 KB | Output is correct |
31 | Correct | 2 ms | 596 KB | Output is correct |
32 | Correct | 2 ms | 584 KB | Output is correct |
33 | Correct | 2 ms | 596 KB | Output is correct |
34 | Correct | 2 ms | 596 KB | Output is correct |
35 | Correct | 2 ms | 636 KB | Output is correct |
36 | Correct | 2 ms | 596 KB | Output is correct |
37 | Correct | 2 ms | 704 KB | Output is correct |
38 | Correct | 2 ms | 596 KB | Output is correct |
39 | Correct | 2 ms | 596 KB | Output is correct |
40 | Correct | 2 ms | 596 KB | Output is correct |
41 | Correct | 2 ms | 596 KB | Output is correct |
42 | Correct | 2 ms | 596 KB | Output is correct |
43 | Correct | 2 ms | 640 KB | Output is correct |
44 | Correct | 2 ms | 596 KB | Output is correct |
45 | Correct | 2 ms | 596 KB | Output is correct |
46 | Correct | 2 ms | 596 KB | Output is correct |
47 | Correct | 2 ms | 588 KB | Output is correct |
48 | Correct | 2 ms | 596 KB | Output is correct |
49 | Correct | 2 ms | 596 KB | Output is correct |
50 | Correct | 2 ms | 588 KB | Output is correct |
51 | Correct | 2 ms | 588 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 320 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 320 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 320 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 328 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 324 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 328 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 324 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 340 KB | Output is correct |
27 | Correct | 2 ms | 680 KB | Output is correct |
28 | Correct | 2 ms | 596 KB | Output is correct |
29 | Correct | 2 ms | 596 KB | Output is correct |
30 | Correct | 2 ms | 596 KB | Output is correct |
31 | Correct | 2 ms | 596 KB | Output is correct |
32 | Correct | 2 ms | 584 KB | Output is correct |
33 | Correct | 2 ms | 596 KB | Output is correct |
34 | Correct | 2 ms | 596 KB | Output is correct |
35 | Correct | 2 ms | 636 KB | Output is correct |
36 | Correct | 2 ms | 596 KB | Output is correct |
37 | Correct | 2 ms | 704 KB | Output is correct |
38 | Correct | 2 ms | 596 KB | Output is correct |
39 | Correct | 2 ms | 596 KB | Output is correct |
40 | Correct | 2 ms | 596 KB | Output is correct |
41 | Correct | 2 ms | 596 KB | Output is correct |
42 | Correct | 2 ms | 596 KB | Output is correct |
43 | Correct | 2 ms | 640 KB | Output is correct |
44 | Correct | 2 ms | 596 KB | Output is correct |
45 | Correct | 2 ms | 596 KB | Output is correct |
46 | Correct | 2 ms | 596 KB | Output is correct |
47 | Correct | 2 ms | 588 KB | Output is correct |
48 | Correct | 2 ms | 596 KB | Output is correct |
49 | Correct | 2 ms | 596 KB | Output is correct |
50 | Correct | 2 ms | 588 KB | Output is correct |
51 | Correct | 2 ms | 588 KB | Output is correct |
52 | Correct | 181 ms | 28672 KB | Output is correct |
53 | Correct | 139 ms | 28804 KB | Output is correct |
54 | Correct | 140 ms | 28712 KB | Output is correct |
55 | Correct | 146 ms | 28816 KB | Output is correct |
56 | Correct | 137 ms | 28732 KB | Output is correct |
57 | Correct | 167 ms | 28744 KB | Output is correct |
58 | Correct | 138 ms | 28720 KB | Output is correct |
59 | Correct | 140 ms | 28764 KB | Output is correct |
60 | Correct | 141 ms | 28732 KB | Output is correct |
61 | Correct | 147 ms | 28600 KB | Output is correct |
62 | Correct | 150 ms | 28692 KB | Output is correct |
63 | Correct | 147 ms | 28832 KB | Output is correct |
64 | Correct | 139 ms | 28716 KB | Output is correct |
65 | Correct | 139 ms | 28716 KB | Output is correct |
66 | Correct | 145 ms | 28752 KB | Output is correct |
67 | Correct | 137 ms | 28728 KB | Output is correct |
68 | Correct | 142 ms | 28772 KB | Output is correct |