답안 #799869

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
799869 2023-08-01T07:22:12 Z phoenix Team Contest (JOI22_team) C++17
100 / 100
369 ms 27148 KB
#include<bits/stdc++.h>

using namespace std;
using ll = long long;


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    set<pair<int, int>> xx, yy, zz;
    int x[n], y[n], z[n];
    for(int i = 0; i < n; i++) {
        cin >> x[i] >> y[i] >> z[i];
        xx.insert({x[i], i});
        yy.insert({y[i], i});
        zz.insert({z[i], i});
    }
    while(!xx.empty()) {
        int pos = (--xx.end())->second;
        if(y[pos] == (--yy.end())->first || z[pos] == (--zz.end())->first) {
            xx.erase({x[pos], pos}), yy.erase({y[pos], pos}), zz.erase({z[pos], pos});
            continue;
        }
        pos = (--yy.end())->second;
        if(x[pos] == (--xx.end())->first || z[pos] == (--zz.end())->first) {
            xx.erase({x[pos], pos}), yy.erase({y[pos], pos}), zz.erase({z[pos], pos});
            continue;
        }
        pos = (--zz.end())->second;
        if(x[pos] == (--xx.end())->first || y[pos] == (--yy.end())->first) {
            xx.erase({x[pos], pos}), yy.erase({y[pos], pos}), zz.erase({z[pos], pos});
            continue;
        }
        cout << (--xx.end())->first + (--yy.end())->first + (--zz.end())->first;
        return 0;
    }
    cout << -1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 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 0 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 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 280 KB Output is correct
15 Correct 1 ms 328 KB Output is correct
16 Correct 1 ms 328 KB Output is correct
17 Correct 1 ms 324 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 272 KB Output is correct
20 Correct 1 ms 316 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 340 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 1 ms 212 KB Output is correct
2 Correct 1 ms 320 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 0 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 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 280 KB Output is correct
15 Correct 1 ms 328 KB Output is correct
16 Correct 1 ms 328 KB Output is correct
17 Correct 1 ms 324 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 272 KB Output is correct
20 Correct 1 ms 316 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 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 3 ms 980 KB Output is correct
27 Correct 4 ms 980 KB Output is correct
28 Correct 4 ms 968 KB Output is correct
29 Correct 4 ms 980 KB Output is correct
30 Correct 3 ms 712 KB Output is correct
31 Correct 3 ms 980 KB Output is correct
32 Correct 4 ms 852 KB Output is correct
33 Correct 4 ms 1004 KB Output is correct
34 Correct 3 ms 980 KB Output is correct
35 Correct 1 ms 468 KB Output is correct
36 Correct 1 ms 464 KB Output is correct
37 Correct 2 ms 980 KB Output is correct
38 Correct 3 ms 908 KB Output is correct
39 Correct 1 ms 596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 320 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 122 ms 24072 KB Output is correct
12 Correct 98 ms 16108 KB Output is correct
13 Correct 91 ms 19744 KB Output is correct
14 Correct 167 ms 24064 KB Output is correct
15 Correct 122 ms 24032 KB Output is correct
16 Correct 126 ms 24012 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 320 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 122 ms 24072 KB Output is correct
12 Correct 98 ms 16108 KB Output is correct
13 Correct 91 ms 19744 KB Output is correct
14 Correct 167 ms 24064 KB Output is correct
15 Correct 122 ms 24032 KB Output is correct
16 Correct 126 ms 24012 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 316 KB Output is correct
21 Correct 2 ms 592 KB Output is correct
22 Correct 171 ms 24268 KB Output is correct
23 Correct 162 ms 23500 KB Output is correct
24 Correct 128 ms 17656 KB Output is correct
25 Correct 209 ms 24296 KB Output is correct
26 Correct 168 ms 24112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 320 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 122 ms 24072 KB Output is correct
12 Correct 98 ms 16108 KB Output is correct
13 Correct 91 ms 19744 KB Output is correct
14 Correct 167 ms 24064 KB Output is correct
15 Correct 122 ms 24032 KB Output is correct
16 Correct 126 ms 24012 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 316 KB Output is correct
21 Correct 2 ms 592 KB Output is correct
22 Correct 171 ms 24268 KB Output is correct
23 Correct 162 ms 23500 KB Output is correct
24 Correct 128 ms 17656 KB Output is correct
25 Correct 209 ms 24296 KB Output is correct
26 Correct 168 ms 24112 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 5 ms 980 KB Output is correct
32 Correct 1 ms 468 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 235 ms 23628 KB Output is correct
35 Correct 247 ms 22456 KB Output is correct
36 Correct 245 ms 24704 KB Output is correct
37 Correct 319 ms 24592 KB Output is correct
38 Correct 176 ms 24208 KB Output is correct
39 Correct 71 ms 15028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 320 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 122 ms 24072 KB Output is correct
12 Correct 98 ms 16108 KB Output is correct
13 Correct 91 ms 19744 KB Output is correct
14 Correct 167 ms 24064 KB Output is correct
15 Correct 122 ms 24032 KB Output is correct
16 Correct 126 ms 24012 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 316 KB Output is correct
21 Correct 2 ms 592 KB Output is correct
22 Correct 171 ms 24268 KB Output is correct
23 Correct 162 ms 23500 KB Output is correct
24 Correct 128 ms 17656 KB Output is correct
25 Correct 209 ms 24296 KB Output is correct
26 Correct 168 ms 24112 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 5 ms 980 KB Output is correct
32 Correct 1 ms 468 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 235 ms 23628 KB Output is correct
35 Correct 247 ms 22456 KB Output is correct
36 Correct 245 ms 24704 KB Output is correct
37 Correct 319 ms 24592 KB Output is correct
38 Correct 176 ms 24208 KB Output is correct
39 Correct 71 ms 15028 KB Output is correct
40 Correct 3 ms 716 KB Output is correct
41 Correct 5 ms 852 KB Output is correct
42 Correct 3 ms 980 KB Output is correct
43 Correct 3 ms 968 KB Output is correct
44 Correct 291 ms 25272 KB Output is correct
45 Correct 349 ms 25312 KB Output is correct
46 Correct 350 ms 25152 KB Output is correct
47 Correct 369 ms 25340 KB Output is correct
48 Correct 199 ms 25164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 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 0 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 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 280 KB Output is correct
15 Correct 1 ms 328 KB Output is correct
16 Correct 1 ms 328 KB Output is correct
17 Correct 1 ms 324 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 272 KB Output is correct
20 Correct 1 ms 316 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 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 3 ms 980 KB Output is correct
27 Correct 4 ms 980 KB Output is correct
28 Correct 4 ms 968 KB Output is correct
29 Correct 4 ms 980 KB Output is correct
30 Correct 3 ms 712 KB Output is correct
31 Correct 3 ms 980 KB Output is correct
32 Correct 4 ms 852 KB Output is correct
33 Correct 4 ms 1004 KB Output is correct
34 Correct 3 ms 980 KB Output is correct
35 Correct 1 ms 468 KB Output is correct
36 Correct 1 ms 464 KB Output is correct
37 Correct 2 ms 980 KB Output is correct
38 Correct 3 ms 908 KB Output is correct
39 Correct 1 ms 596 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 0 ms 320 KB Output is correct
44 Correct 1 ms 340 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 320 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 122 ms 24072 KB Output is correct
51 Correct 98 ms 16108 KB Output is correct
52 Correct 91 ms 19744 KB Output is correct
53 Correct 167 ms 24064 KB Output is correct
54 Correct 122 ms 24032 KB Output is correct
55 Correct 126 ms 24012 KB Output is correct
56 Correct 1 ms 212 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 1 ms 316 KB Output is correct
60 Correct 2 ms 592 KB Output is correct
61 Correct 171 ms 24268 KB Output is correct
62 Correct 162 ms 23500 KB Output is correct
63 Correct 128 ms 17656 KB Output is correct
64 Correct 209 ms 24296 KB Output is correct
65 Correct 168 ms 24112 KB Output is correct
66 Correct 1 ms 340 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 1 ms 340 KB Output is correct
69 Correct 1 ms 340 KB Output is correct
70 Correct 5 ms 980 KB Output is correct
71 Correct 1 ms 468 KB Output is correct
72 Correct 1 ms 340 KB Output is correct
73 Correct 235 ms 23628 KB Output is correct
74 Correct 247 ms 22456 KB Output is correct
75 Correct 245 ms 24704 KB Output is correct
76 Correct 319 ms 24592 KB Output is correct
77 Correct 176 ms 24208 KB Output is correct
78 Correct 71 ms 15028 KB Output is correct
79 Correct 3 ms 716 KB Output is correct
80 Correct 5 ms 852 KB Output is correct
81 Correct 3 ms 980 KB Output is correct
82 Correct 3 ms 968 KB Output is correct
83 Correct 291 ms 25272 KB Output is correct
84 Correct 349 ms 25312 KB Output is correct
85 Correct 350 ms 25152 KB Output is correct
86 Correct 369 ms 25340 KB Output is correct
87 Correct 199 ms 25164 KB Output is correct
88 Correct 262 ms 27044 KB Output is correct
89 Correct 295 ms 27092 KB Output is correct
90 Correct 277 ms 27084 KB Output is correct
91 Correct 303 ms 27072 KB Output is correct
92 Correct 269 ms 25620 KB Output is correct
93 Correct 317 ms 25892 KB Output is correct
94 Correct 327 ms 25796 KB Output is correct
95 Correct 209 ms 26984 KB Output is correct
96 Correct 189 ms 27096 KB Output is correct
97 Correct 124 ms 27148 KB Output is correct
98 Correct 106 ms 25676 KB Output is correct
99 Correct 126 ms 25636 KB Output is correct