# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
998296 |
2024-06-13T14:27:17 Z |
abczz |
Team Contest (JOI22_team) |
C++17 |
|
151 ms |
14924 KB |
#include <iostream>
#include <array>
#include <algorithm>
#define ll long long
using namespace std;
array <ll, 3> A[150000], B[150000], C[150000];
bool ok;
ll n;
int main() {
cin >> n;
for (int i=0; i<n; ++i) {
for (int j=0; j<3; ++j) {
cin >> A[i][j];
B[i][j] = C[i][j] = A[i][j];
}
}
sort(A, A+n, [](auto a, auto b) {
return a[0] > b[0];
});
sort(B, B+n, [](auto a, auto b) {
return a[1] > b[1];
});
sort(C, C+n, [](auto a, auto b) {
return a[2] > b[2];
});
int i = 0, j = 0, k = 0;
while (i < n && j < n && k < n) {
ok = 0;
while (j < n && A[i][0] <= B[j][0]) ++j, ok = 1;
while (k < n && A[i][0] <= C[k][0]) ++k, ok = 1;
if (j >= n || k >= n) break;
while (i < n && B[j][1] <= A[i][1]) ++i, ok = 1;
while (k < n && B[j][1] <= C[k][1]) ++k, ok = 1;
if (i >= n || k >= n) break;
while (i < n && C[k][2] <= A[i][2]) ++i, ok = 1;
while (j < n && C[k][2] <= B[j][2]) ++j, ok = 1;
if (i >= n || j >= n) break;
if (!ok) {
cout << A[i][0] + B[j][1] + C[k][2] << '\n';
return 0;
}
}
cout << "-1\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4696 KB |
Output is correct |
5 |
Correct |
1 ms |
4444 KB |
Output is correct |
6 |
Correct |
1 ms |
4544 KB |
Output is correct |
7 |
Correct |
0 ms |
4552 KB |
Output is correct |
8 |
Correct |
1 ms |
4444 KB |
Output is correct |
9 |
Correct |
1 ms |
4444 KB |
Output is correct |
10 |
Correct |
1 ms |
4444 KB |
Output is correct |
11 |
Correct |
1 ms |
4440 KB |
Output is correct |
12 |
Correct |
1 ms |
4444 KB |
Output is correct |
13 |
Correct |
1 ms |
4444 KB |
Output is correct |
14 |
Correct |
1 ms |
4444 KB |
Output is correct |
15 |
Correct |
1 ms |
4444 KB |
Output is correct |
16 |
Correct |
1 ms |
4444 KB |
Output is correct |
17 |
Correct |
1 ms |
4444 KB |
Output is correct |
18 |
Correct |
1 ms |
4444 KB |
Output is correct |
19 |
Correct |
1 ms |
4444 KB |
Output is correct |
20 |
Correct |
1 ms |
4444 KB |
Output is correct |
21 |
Correct |
1 ms |
4444 KB |
Output is correct |
22 |
Correct |
1 ms |
4444 KB |
Output is correct |
23 |
Correct |
1 ms |
4440 KB |
Output is correct |
24 |
Correct |
1 ms |
4444 KB |
Output is correct |
25 |
Correct |
1 ms |
4444 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4696 KB |
Output is correct |
5 |
Correct |
1 ms |
4444 KB |
Output is correct |
6 |
Correct |
1 ms |
4544 KB |
Output is correct |
7 |
Correct |
0 ms |
4552 KB |
Output is correct |
8 |
Correct |
1 ms |
4444 KB |
Output is correct |
9 |
Correct |
1 ms |
4444 KB |
Output is correct |
10 |
Correct |
1 ms |
4444 KB |
Output is correct |
11 |
Correct |
1 ms |
4440 KB |
Output is correct |
12 |
Correct |
1 ms |
4444 KB |
Output is correct |
13 |
Correct |
1 ms |
4444 KB |
Output is correct |
14 |
Correct |
1 ms |
4444 KB |
Output is correct |
15 |
Correct |
1 ms |
4444 KB |
Output is correct |
16 |
Correct |
1 ms |
4444 KB |
Output is correct |
17 |
Correct |
1 ms |
4444 KB |
Output is correct |
18 |
Correct |
1 ms |
4444 KB |
Output is correct |
19 |
Correct |
1 ms |
4444 KB |
Output is correct |
20 |
Correct |
1 ms |
4444 KB |
Output is correct |
21 |
Correct |
1 ms |
4444 KB |
Output is correct |
22 |
Correct |
1 ms |
4444 KB |
Output is correct |
23 |
Correct |
1 ms |
4440 KB |
Output is correct |
24 |
Correct |
1 ms |
4444 KB |
Output is correct |
25 |
Correct |
1 ms |
4444 KB |
Output is correct |
26 |
Correct |
4 ms |
4700 KB |
Output is correct |
27 |
Correct |
4 ms |
4700 KB |
Output is correct |
28 |
Correct |
4 ms |
4700 KB |
Output is correct |
29 |
Correct |
4 ms |
4700 KB |
Output is correct |
30 |
Correct |
2 ms |
4548 KB |
Output is correct |
31 |
Correct |
3 ms |
4440 KB |
Output is correct |
32 |
Correct |
3 ms |
4444 KB |
Output is correct |
33 |
Correct |
4 ms |
4696 KB |
Output is correct |
34 |
Correct |
5 ms |
4700 KB |
Output is correct |
35 |
Correct |
1 ms |
4444 KB |
Output is correct |
36 |
Correct |
1 ms |
4524 KB |
Output is correct |
37 |
Correct |
2 ms |
4444 KB |
Output is correct |
38 |
Correct |
3 ms |
4440 KB |
Output is correct |
39 |
Correct |
1 ms |
4700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Correct |
1 ms |
4444 KB |
Output is correct |
6 |
Correct |
1 ms |
4440 KB |
Output is correct |
7 |
Correct |
1 ms |
4440 KB |
Output is correct |
8 |
Correct |
1 ms |
4444 KB |
Output is correct |
9 |
Correct |
1 ms |
4444 KB |
Output is correct |
10 |
Correct |
1 ms |
4444 KB |
Output is correct |
11 |
Correct |
60 ms |
11860 KB |
Output is correct |
12 |
Correct |
35 ms |
11352 KB |
Output is correct |
13 |
Correct |
41 ms |
11352 KB |
Output is correct |
14 |
Correct |
53 ms |
11744 KB |
Output is correct |
15 |
Correct |
51 ms |
11852 KB |
Output is correct |
16 |
Correct |
49 ms |
11856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Correct |
1 ms |
4444 KB |
Output is correct |
6 |
Correct |
1 ms |
4440 KB |
Output is correct |
7 |
Correct |
1 ms |
4440 KB |
Output is correct |
8 |
Correct |
1 ms |
4444 KB |
Output is correct |
9 |
Correct |
1 ms |
4444 KB |
Output is correct |
10 |
Correct |
1 ms |
4444 KB |
Output is correct |
11 |
Correct |
60 ms |
11860 KB |
Output is correct |
12 |
Correct |
35 ms |
11352 KB |
Output is correct |
13 |
Correct |
41 ms |
11352 KB |
Output is correct |
14 |
Correct |
53 ms |
11744 KB |
Output is correct |
15 |
Correct |
51 ms |
11852 KB |
Output is correct |
16 |
Correct |
49 ms |
11856 KB |
Output is correct |
17 |
Correct |
1 ms |
4696 KB |
Output is correct |
18 |
Correct |
1 ms |
4444 KB |
Output is correct |
19 |
Correct |
1 ms |
4444 KB |
Output is correct |
20 |
Correct |
1 ms |
4444 KB |
Output is correct |
21 |
Correct |
2 ms |
4444 KB |
Output is correct |
22 |
Correct |
62 ms |
11972 KB |
Output is correct |
23 |
Correct |
55 ms |
11604 KB |
Output is correct |
24 |
Correct |
45 ms |
11608 KB |
Output is correct |
25 |
Correct |
65 ms |
12112 KB |
Output is correct |
26 |
Correct |
54 ms |
11860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Correct |
1 ms |
4444 KB |
Output is correct |
6 |
Correct |
1 ms |
4440 KB |
Output is correct |
7 |
Correct |
1 ms |
4440 KB |
Output is correct |
8 |
Correct |
1 ms |
4444 KB |
Output is correct |
9 |
Correct |
1 ms |
4444 KB |
Output is correct |
10 |
Correct |
1 ms |
4444 KB |
Output is correct |
11 |
Correct |
60 ms |
11860 KB |
Output is correct |
12 |
Correct |
35 ms |
11352 KB |
Output is correct |
13 |
Correct |
41 ms |
11352 KB |
Output is correct |
14 |
Correct |
53 ms |
11744 KB |
Output is correct |
15 |
Correct |
51 ms |
11852 KB |
Output is correct |
16 |
Correct |
49 ms |
11856 KB |
Output is correct |
17 |
Correct |
1 ms |
4696 KB |
Output is correct |
18 |
Correct |
1 ms |
4444 KB |
Output is correct |
19 |
Correct |
1 ms |
4444 KB |
Output is correct |
20 |
Correct |
1 ms |
4444 KB |
Output is correct |
21 |
Correct |
2 ms |
4444 KB |
Output is correct |
22 |
Correct |
62 ms |
11972 KB |
Output is correct |
23 |
Correct |
55 ms |
11604 KB |
Output is correct |
24 |
Correct |
45 ms |
11608 KB |
Output is correct |
25 |
Correct |
65 ms |
12112 KB |
Output is correct |
26 |
Correct |
54 ms |
11860 KB |
Output is correct |
27 |
Correct |
1 ms |
4444 KB |
Output is correct |
28 |
Correct |
1 ms |
4444 KB |
Output is correct |
29 |
Correct |
1 ms |
4444 KB |
Output is correct |
30 |
Correct |
1 ms |
4444 KB |
Output is correct |
31 |
Correct |
3 ms |
4444 KB |
Output is correct |
32 |
Correct |
1 ms |
4444 KB |
Output is correct |
33 |
Correct |
1 ms |
4576 KB |
Output is correct |
34 |
Correct |
73 ms |
12368 KB |
Output is correct |
35 |
Correct |
68 ms |
12112 KB |
Output is correct |
36 |
Correct |
74 ms |
12492 KB |
Output is correct |
37 |
Correct |
74 ms |
12628 KB |
Output is correct |
38 |
Correct |
71 ms |
12236 KB |
Output is correct |
39 |
Correct |
38 ms |
11608 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Correct |
1 ms |
4444 KB |
Output is correct |
6 |
Correct |
1 ms |
4440 KB |
Output is correct |
7 |
Correct |
1 ms |
4440 KB |
Output is correct |
8 |
Correct |
1 ms |
4444 KB |
Output is correct |
9 |
Correct |
1 ms |
4444 KB |
Output is correct |
10 |
Correct |
1 ms |
4444 KB |
Output is correct |
11 |
Correct |
60 ms |
11860 KB |
Output is correct |
12 |
Correct |
35 ms |
11352 KB |
Output is correct |
13 |
Correct |
41 ms |
11352 KB |
Output is correct |
14 |
Correct |
53 ms |
11744 KB |
Output is correct |
15 |
Correct |
51 ms |
11852 KB |
Output is correct |
16 |
Correct |
49 ms |
11856 KB |
Output is correct |
17 |
Correct |
1 ms |
4696 KB |
Output is correct |
18 |
Correct |
1 ms |
4444 KB |
Output is correct |
19 |
Correct |
1 ms |
4444 KB |
Output is correct |
20 |
Correct |
1 ms |
4444 KB |
Output is correct |
21 |
Correct |
2 ms |
4444 KB |
Output is correct |
22 |
Correct |
62 ms |
11972 KB |
Output is correct |
23 |
Correct |
55 ms |
11604 KB |
Output is correct |
24 |
Correct |
45 ms |
11608 KB |
Output is correct |
25 |
Correct |
65 ms |
12112 KB |
Output is correct |
26 |
Correct |
54 ms |
11860 KB |
Output is correct |
27 |
Correct |
1 ms |
4444 KB |
Output is correct |
28 |
Correct |
1 ms |
4444 KB |
Output is correct |
29 |
Correct |
1 ms |
4444 KB |
Output is correct |
30 |
Correct |
1 ms |
4444 KB |
Output is correct |
31 |
Correct |
3 ms |
4444 KB |
Output is correct |
32 |
Correct |
1 ms |
4444 KB |
Output is correct |
33 |
Correct |
1 ms |
4576 KB |
Output is correct |
34 |
Correct |
73 ms |
12368 KB |
Output is correct |
35 |
Correct |
68 ms |
12112 KB |
Output is correct |
36 |
Correct |
74 ms |
12492 KB |
Output is correct |
37 |
Correct |
74 ms |
12628 KB |
Output is correct |
38 |
Correct |
71 ms |
12236 KB |
Output is correct |
39 |
Correct |
38 ms |
11608 KB |
Output is correct |
40 |
Correct |
2 ms |
4444 KB |
Output is correct |
41 |
Correct |
3 ms |
4440 KB |
Output is correct |
42 |
Correct |
3 ms |
4440 KB |
Output is correct |
43 |
Correct |
3 ms |
4692 KB |
Output is correct |
44 |
Correct |
88 ms |
12880 KB |
Output is correct |
45 |
Correct |
93 ms |
12884 KB |
Output is correct |
46 |
Correct |
92 ms |
12880 KB |
Output is correct |
47 |
Correct |
95 ms |
13140 KB |
Output is correct |
48 |
Correct |
74 ms |
12880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4696 KB |
Output is correct |
5 |
Correct |
1 ms |
4444 KB |
Output is correct |
6 |
Correct |
1 ms |
4544 KB |
Output is correct |
7 |
Correct |
0 ms |
4552 KB |
Output is correct |
8 |
Correct |
1 ms |
4444 KB |
Output is correct |
9 |
Correct |
1 ms |
4444 KB |
Output is correct |
10 |
Correct |
1 ms |
4444 KB |
Output is correct |
11 |
Correct |
1 ms |
4440 KB |
Output is correct |
12 |
Correct |
1 ms |
4444 KB |
Output is correct |
13 |
Correct |
1 ms |
4444 KB |
Output is correct |
14 |
Correct |
1 ms |
4444 KB |
Output is correct |
15 |
Correct |
1 ms |
4444 KB |
Output is correct |
16 |
Correct |
1 ms |
4444 KB |
Output is correct |
17 |
Correct |
1 ms |
4444 KB |
Output is correct |
18 |
Correct |
1 ms |
4444 KB |
Output is correct |
19 |
Correct |
1 ms |
4444 KB |
Output is correct |
20 |
Correct |
1 ms |
4444 KB |
Output is correct |
21 |
Correct |
1 ms |
4444 KB |
Output is correct |
22 |
Correct |
1 ms |
4444 KB |
Output is correct |
23 |
Correct |
1 ms |
4440 KB |
Output is correct |
24 |
Correct |
1 ms |
4444 KB |
Output is correct |
25 |
Correct |
1 ms |
4444 KB |
Output is correct |
26 |
Correct |
4 ms |
4700 KB |
Output is correct |
27 |
Correct |
4 ms |
4700 KB |
Output is correct |
28 |
Correct |
4 ms |
4700 KB |
Output is correct |
29 |
Correct |
4 ms |
4700 KB |
Output is correct |
30 |
Correct |
2 ms |
4548 KB |
Output is correct |
31 |
Correct |
3 ms |
4440 KB |
Output is correct |
32 |
Correct |
3 ms |
4444 KB |
Output is correct |
33 |
Correct |
4 ms |
4696 KB |
Output is correct |
34 |
Correct |
5 ms |
4700 KB |
Output is correct |
35 |
Correct |
1 ms |
4444 KB |
Output is correct |
36 |
Correct |
1 ms |
4524 KB |
Output is correct |
37 |
Correct |
2 ms |
4444 KB |
Output is correct |
38 |
Correct |
3 ms |
4440 KB |
Output is correct |
39 |
Correct |
1 ms |
4700 KB |
Output is correct |
40 |
Correct |
1 ms |
4440 KB |
Output is correct |
41 |
Correct |
1 ms |
4444 KB |
Output is correct |
42 |
Correct |
1 ms |
4444 KB |
Output is correct |
43 |
Correct |
1 ms |
4444 KB |
Output is correct |
44 |
Correct |
1 ms |
4444 KB |
Output is correct |
45 |
Correct |
1 ms |
4440 KB |
Output is correct |
46 |
Correct |
1 ms |
4440 KB |
Output is correct |
47 |
Correct |
1 ms |
4444 KB |
Output is correct |
48 |
Correct |
1 ms |
4444 KB |
Output is correct |
49 |
Correct |
1 ms |
4444 KB |
Output is correct |
50 |
Correct |
60 ms |
11860 KB |
Output is correct |
51 |
Correct |
35 ms |
11352 KB |
Output is correct |
52 |
Correct |
41 ms |
11352 KB |
Output is correct |
53 |
Correct |
53 ms |
11744 KB |
Output is correct |
54 |
Correct |
51 ms |
11852 KB |
Output is correct |
55 |
Correct |
49 ms |
11856 KB |
Output is correct |
56 |
Correct |
1 ms |
4696 KB |
Output is correct |
57 |
Correct |
1 ms |
4444 KB |
Output is correct |
58 |
Correct |
1 ms |
4444 KB |
Output is correct |
59 |
Correct |
1 ms |
4444 KB |
Output is correct |
60 |
Correct |
2 ms |
4444 KB |
Output is correct |
61 |
Correct |
62 ms |
11972 KB |
Output is correct |
62 |
Correct |
55 ms |
11604 KB |
Output is correct |
63 |
Correct |
45 ms |
11608 KB |
Output is correct |
64 |
Correct |
65 ms |
12112 KB |
Output is correct |
65 |
Correct |
54 ms |
11860 KB |
Output is correct |
66 |
Correct |
1 ms |
4444 KB |
Output is correct |
67 |
Correct |
1 ms |
4444 KB |
Output is correct |
68 |
Correct |
1 ms |
4444 KB |
Output is correct |
69 |
Correct |
1 ms |
4444 KB |
Output is correct |
70 |
Correct |
3 ms |
4444 KB |
Output is correct |
71 |
Correct |
1 ms |
4444 KB |
Output is correct |
72 |
Correct |
1 ms |
4576 KB |
Output is correct |
73 |
Correct |
73 ms |
12368 KB |
Output is correct |
74 |
Correct |
68 ms |
12112 KB |
Output is correct |
75 |
Correct |
74 ms |
12492 KB |
Output is correct |
76 |
Correct |
74 ms |
12628 KB |
Output is correct |
77 |
Correct |
71 ms |
12236 KB |
Output is correct |
78 |
Correct |
38 ms |
11608 KB |
Output is correct |
79 |
Correct |
2 ms |
4444 KB |
Output is correct |
80 |
Correct |
3 ms |
4440 KB |
Output is correct |
81 |
Correct |
3 ms |
4440 KB |
Output is correct |
82 |
Correct |
3 ms |
4692 KB |
Output is correct |
83 |
Correct |
88 ms |
12880 KB |
Output is correct |
84 |
Correct |
93 ms |
12884 KB |
Output is correct |
85 |
Correct |
92 ms |
12880 KB |
Output is correct |
86 |
Correct |
95 ms |
13140 KB |
Output is correct |
87 |
Correct |
74 ms |
12880 KB |
Output is correct |
88 |
Correct |
137 ms |
14752 KB |
Output is correct |
89 |
Correct |
133 ms |
14672 KB |
Output is correct |
90 |
Correct |
135 ms |
14672 KB |
Output is correct |
91 |
Correct |
151 ms |
14796 KB |
Output is correct |
92 |
Correct |
103 ms |
13260 KB |
Output is correct |
93 |
Correct |
112 ms |
13648 KB |
Output is correct |
94 |
Correct |
107 ms |
13532 KB |
Output is correct |
95 |
Correct |
117 ms |
14688 KB |
Output is correct |
96 |
Correct |
130 ms |
14664 KB |
Output is correct |
97 |
Correct |
107 ms |
14924 KB |
Output is correct |
98 |
Correct |
84 ms |
13392 KB |
Output is correct |
99 |
Correct |
78 ms |
13392 KB |
Output is correct |