# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
544539 | 2022-04-02T09:13:23 Z | Jarif_Rahman | Team Contest (JOI22_team) | C++17 | 415 ms | 20756 KB |
#include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template<class T> using indexed_set = tree<T,null_type,greater<T>,rb_tree_tag, tree_order_statistics_node_update>; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<tuple<int, int, int>> v(n); for(auto &[x, y, z]: v) cin >> x >> y >> z; sort(v.begin(), v.end()); indexed_set<pair<int, int>> s1, s2; int cur = 0; int lsi = 0, ls = -1; int ans = -1; for(int i = 0; i < n; i++){ auto [x, y, z] = v[i]; if(x > ls){ ls = x; for(int j = lsi; j < i; j++){ auto [ig, a, b] = v[j]; if(s1.find(make_pair(a, b)) != s1.end()) continue; s1.insert({a, b}); s2.insert({b, a}); int ai = s1.order_of_key(make_pair(a, b)), bi = s2.order_of_key(make_pair(b, a)); if(ai == bi){ if(ai <= cur) cur++; } else{ cur = min(cur, min(ai, bi)); } } lsi = i; } if(cur < s1.size()){ int a = s1.find_by_order(cur)->f, b = s2.find_by_order(cur)->f; if(a > y && b > z) ans = max(ans, x+a+b); } } cout << ans << "\n"; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 212 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 | 2 ms | 324 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 212 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 212 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 | 2 ms | 324 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 212 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 5 ms | 852 KB | Output is correct |
27 | Correct | 6 ms | 852 KB | Output is correct |
28 | Correct | 5 ms | 852 KB | Output is correct |
29 | Correct | 6 ms | 724 KB | Output is correct |
30 | Correct | 5 ms | 596 KB | Output is correct |
31 | Correct | 6 ms | 852 KB | Output is correct |
32 | Correct | 4 ms | 596 KB | Output is correct |
33 | Correct | 2 ms | 340 KB | Output is correct |
34 | Correct | 5 ms | 852 KB | Output is correct |
35 | Correct | 1 ms | 340 KB | Output is correct |
36 | Correct | 1 ms | 340 KB | Output is correct |
37 | Correct | 27 ms | 596 KB | Output is correct |
38 | Correct | 4 ms | 596 KB | Output is correct |
39 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 2 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 2 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 216 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 33 ms | 2008 KB | Output is correct |
12 | Correct | 26 ms | 1508 KB | Output is correct |
13 | Correct | 25 ms | 1752 KB | Output is correct |
14 | Correct | 33 ms | 2004 KB | Output is correct |
15 | Correct | 28 ms | 2004 KB | Output is correct |
16 | Correct | 26 ms | 2008 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 2 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 2 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 216 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 33 ms | 2008 KB | Output is correct |
12 | Correct | 26 ms | 1508 KB | Output is correct |
13 | Correct | 25 ms | 1752 KB | Output is correct |
14 | Correct | 33 ms | 2004 KB | Output is correct |
15 | Correct | 28 ms | 2004 KB | Output is correct |
16 | Correct | 26 ms | 2008 KB | Output is correct |
17 | Correct | 1 ms | 216 KB | Output is correct |
18 | Correct | 1 ms | 216 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 344 KB | Output is correct |
21 | Correct | 2 ms | 344 KB | Output is correct |
22 | Correct | 64 ms | 2080 KB | Output is correct |
23 | Correct | 38 ms | 2044 KB | Output is correct |
24 | Correct | 31 ms | 1588 KB | Output is correct |
25 | Correct | 42 ms | 2008 KB | Output is correct |
26 | Correct | 31 ms | 2004 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 2 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 2 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 216 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 33 ms | 2008 KB | Output is correct |
12 | Correct | 26 ms | 1508 KB | Output is correct |
13 | Correct | 25 ms | 1752 KB | Output is correct |
14 | Correct | 33 ms | 2004 KB | Output is correct |
15 | Correct | 28 ms | 2004 KB | Output is correct |
16 | Correct | 26 ms | 2008 KB | Output is correct |
17 | Correct | 1 ms | 216 KB | Output is correct |
18 | Correct | 1 ms | 216 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 344 KB | Output is correct |
21 | Correct | 2 ms | 344 KB | Output is correct |
22 | Correct | 64 ms | 2080 KB | Output is correct |
23 | Correct | 38 ms | 2044 KB | Output is correct |
24 | Correct | 31 ms | 1588 KB | Output is correct |
25 | Correct | 42 ms | 2008 KB | Output is correct |
26 | Correct | 31 ms | 2004 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 1 ms | 344 KB | Output is correct |
29 | Correct | 1 ms | 344 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 4 ms | 600 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 1 ms | 340 KB | Output is correct |
34 | Correct | 168 ms | 10844 KB | Output is correct |
35 | Correct | 121 ms | 8436 KB | Output is correct |
36 | Correct | 144 ms | 7784 KB | Output is correct |
37 | Correct | 103 ms | 7148 KB | Output is correct |
38 | Correct | 51 ms | 2004 KB | Output is correct |
39 | Correct | 22 ms | 1364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 2 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 2 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 216 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 33 ms | 2008 KB | Output is correct |
12 | Correct | 26 ms | 1508 KB | Output is correct |
13 | Correct | 25 ms | 1752 KB | Output is correct |
14 | Correct | 33 ms | 2004 KB | Output is correct |
15 | Correct | 28 ms | 2004 KB | Output is correct |
16 | Correct | 26 ms | 2008 KB | Output is correct |
17 | Correct | 1 ms | 216 KB | Output is correct |
18 | Correct | 1 ms | 216 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 344 KB | Output is correct |
21 | Correct | 2 ms | 344 KB | Output is correct |
22 | Correct | 64 ms | 2080 KB | Output is correct |
23 | Correct | 38 ms | 2044 KB | Output is correct |
24 | Correct | 31 ms | 1588 KB | Output is correct |
25 | Correct | 42 ms | 2008 KB | Output is correct |
26 | Correct | 31 ms | 2004 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 1 ms | 344 KB | Output is correct |
29 | Correct | 1 ms | 344 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 4 ms | 600 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 1 ms | 340 KB | Output is correct |
34 | Correct | 168 ms | 10844 KB | Output is correct |
35 | Correct | 121 ms | 8436 KB | Output is correct |
36 | Correct | 144 ms | 7784 KB | Output is correct |
37 | Correct | 103 ms | 7148 KB | Output is correct |
38 | Correct | 51 ms | 2004 KB | Output is correct |
39 | Correct | 22 ms | 1364 KB | Output is correct |
40 | Correct | 4 ms | 596 KB | Output is correct |
41 | Correct | 5 ms | 852 KB | Output is correct |
42 | Correct | 4 ms | 596 KB | Output is correct |
43 | Correct | 6 ms | 596 KB | Output is correct |
44 | Correct | 415 ms | 20676 KB | Output is correct |
45 | Correct | 231 ms | 15488 KB | Output is correct |
46 | Correct | 266 ms | 17176 KB | Output is correct |
47 | Correct | 229 ms | 14888 KB | Output is correct |
48 | Correct | 72 ms | 2004 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 212 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 | 2 ms | 324 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 212 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 5 ms | 852 KB | Output is correct |
27 | Correct | 6 ms | 852 KB | Output is correct |
28 | Correct | 5 ms | 852 KB | Output is correct |
29 | Correct | 6 ms | 724 KB | Output is correct |
30 | Correct | 5 ms | 596 KB | Output is correct |
31 | Correct | 6 ms | 852 KB | Output is correct |
32 | Correct | 4 ms | 596 KB | Output is correct |
33 | Correct | 2 ms | 340 KB | Output is correct |
34 | Correct | 5 ms | 852 KB | Output is correct |
35 | Correct | 1 ms | 340 KB | Output is correct |
36 | Correct | 1 ms | 340 KB | Output is correct |
37 | Correct | 27 ms | 596 KB | Output is correct |
38 | Correct | 4 ms | 596 KB | Output is correct |
39 | Correct | 1 ms | 340 KB | Output is correct |
40 | Correct | 0 ms | 212 KB | Output is correct |
41 | Correct | 0 ms | 212 KB | Output is correct |
42 | Correct | 0 ms | 212 KB | Output is correct |
43 | Correct | 0 ms | 212 KB | Output is correct |
44 | Correct | 0 ms | 212 KB | Output is correct |
45 | Correct | 2 ms | 212 KB | Output is correct |
46 | Correct | 1 ms | 212 KB | Output is correct |
47 | Correct | 2 ms | 212 KB | Output is correct |
48 | Correct | 1 ms | 216 KB | Output is correct |
49 | Correct | 0 ms | 212 KB | Output is correct |
50 | Correct | 33 ms | 2008 KB | Output is correct |
51 | Correct | 26 ms | 1508 KB | Output is correct |
52 | Correct | 25 ms | 1752 KB | Output is correct |
53 | Correct | 33 ms | 2004 KB | Output is correct |
54 | Correct | 28 ms | 2004 KB | Output is correct |
55 | Correct | 26 ms | 2008 KB | Output is correct |
56 | Correct | 1 ms | 216 KB | Output is correct |
57 | Correct | 1 ms | 216 KB | Output is correct |
58 | Correct | 0 ms | 212 KB | Output is correct |
59 | Correct | 1 ms | 344 KB | Output is correct |
60 | Correct | 2 ms | 344 KB | Output is correct |
61 | Correct | 64 ms | 2080 KB | Output is correct |
62 | Correct | 38 ms | 2044 KB | Output is correct |
63 | Correct | 31 ms | 1588 KB | Output is correct |
64 | Correct | 42 ms | 2008 KB | Output is correct |
65 | Correct | 31 ms | 2004 KB | Output is correct |
66 | Correct | 1 ms | 340 KB | Output is correct |
67 | Correct | 1 ms | 344 KB | Output is correct |
68 | Correct | 1 ms | 344 KB | Output is correct |
69 | Correct | 1 ms | 340 KB | Output is correct |
70 | Correct | 4 ms | 600 KB | Output is correct |
71 | Correct | 1 ms | 340 KB | Output is correct |
72 | Correct | 1 ms | 340 KB | Output is correct |
73 | Correct | 168 ms | 10844 KB | Output is correct |
74 | Correct | 121 ms | 8436 KB | Output is correct |
75 | Correct | 144 ms | 7784 KB | Output is correct |
76 | Correct | 103 ms | 7148 KB | Output is correct |
77 | Correct | 51 ms | 2004 KB | Output is correct |
78 | Correct | 22 ms | 1364 KB | Output is correct |
79 | Correct | 4 ms | 596 KB | Output is correct |
80 | Correct | 5 ms | 852 KB | Output is correct |
81 | Correct | 4 ms | 596 KB | Output is correct |
82 | Correct | 6 ms | 596 KB | Output is correct |
83 | Correct | 415 ms | 20676 KB | Output is correct |
84 | Correct | 231 ms | 15488 KB | Output is correct |
85 | Correct | 266 ms | 17176 KB | Output is correct |
86 | Correct | 229 ms | 14888 KB | Output is correct |
87 | Correct | 72 ms | 2004 KB | Output is correct |
88 | Correct | 387 ms | 20740 KB | Output is correct |
89 | Correct | 321 ms | 19968 KB | Output is correct |
90 | Correct | 359 ms | 20632 KB | Output is correct |
91 | Correct | 308 ms | 19476 KB | Output is correct |
92 | Correct | 321 ms | 20228 KB | Output is correct |
93 | Correct | 294 ms | 20068 KB | Output is correct |
94 | Correct | 309 ms | 18788 KB | Output is correct |
95 | Correct | 53 ms | 2004 KB | Output is correct |
96 | Correct | 280 ms | 20756 KB | Output is correct |
97 | Correct | 60 ms | 2004 KB | Output is correct |
98 | Correct | 226 ms | 14504 KB | Output is correct |
99 | Correct | 236 ms | 14492 KB | Output is correct |