Submission #962927

# Submission time Handle Problem Language Result Execution time Memory
962927 2024-04-14T09:49:07 Z marinaluca Team Contest (JOI22_team) C++14
100 / 100
410 ms 37096 KB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#pragma GCC optimize ("O4")
#pragma GCC optimize ("fast-math")
#pragma GCC optimize ("unroll-loops")

using namespace std;
#define int long long
#define ll long long
#define XX first
#define YY second
#define pb push_back
#define sz (x) int(x.size())
#define pf pop_front
#define pob pop_back
#define pff push_front

const int NMAX = 2e5 + 100;
set <pair <int, int>> xx, yy, zz;
int x[NMAX + 1], y[NMAX + 1], z[NMAX + 1];

signed main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, sum = -1;
    cin >> n;
    for (int i = 1; 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() && !yy.empty() && !zz.empty()){
        int x1 = xx.rbegin()->second;
        int y1 = yy.rbegin()->second;
        int z1 = zz.rbegin()->second;
        if (y[x1] >= y[y1] || z[x1] >= z[z1]){
            xx.erase({x[x1], x1});
            yy.erase({y[x1], x1});
            zz.erase({z[x1], x1});
            continue;
        }
        if (x[y1] >= x[x1] || z[y1] >= z[z1]){
            xx.erase({x[y1], y1});
            yy.erase({y[y1], y1});
            zz.erase({z[y1], y1});
            continue;
        }
        if (x[z1] >= x[x1] || y[z1] >= y[y1]){
            xx.erase({x[z1], z1});
            yy.erase({y[z1], z1});
            zz.erase({z[z1], z1});
            continue;
        }
        sum = x[x1] + y[y1] + z[z1];
        break;
    }
    cout << sum;
    return 0 ^ 0;
}
# 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 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4560 KB Output is correct
7 Correct 1 ms 4444 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 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4564 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 4440 KB Output is correct
19 Correct 1 ms 4440 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 4568 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 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4560 KB Output is correct
7 Correct 1 ms 4444 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 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4564 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 4440 KB Output is correct
19 Correct 1 ms 4440 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 4568 KB Output is correct
24 Correct 1 ms 4444 KB Output is correct
25 Correct 1 ms 4444 KB Output is correct
26 Correct 5 ms 5580 KB Output is correct
27 Correct 6 ms 5212 KB Output is correct
28 Correct 6 ms 5212 KB Output is correct
29 Correct 5 ms 5212 KB Output is correct
30 Correct 3 ms 4952 KB Output is correct
31 Correct 4 ms 5212 KB Output is correct
32 Correct 5 ms 5324 KB Output is correct
33 Correct 4 ms 5212 KB Output is correct
34 Correct 5 ms 5444 KB Output is correct
35 Correct 2 ms 4700 KB Output is correct
36 Correct 2 ms 4700 KB Output is correct
37 Correct 3 ms 5212 KB Output is correct
38 Correct 4 ms 5360 KB Output is correct
39 Correct 2 ms 4840 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4452 KB Output is correct
3 Correct 1 ms 4448 KB Output is correct
4 Correct 1 ms 4448 KB Output is correct
5 Correct 1 ms 4576 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4448 KB Output is correct
8 Correct 1 ms 4448 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4564 KB Output is correct
11 Correct 160 ms 33936 KB Output is correct
12 Correct 128 ms 24104 KB Output is correct
13 Correct 113 ms 28576 KB Output is correct
14 Correct 200 ms 33676 KB Output is correct
15 Correct 144 ms 33872 KB Output is correct
16 Correct 133 ms 33624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4452 KB Output is correct
3 Correct 1 ms 4448 KB Output is correct
4 Correct 1 ms 4448 KB Output is correct
5 Correct 1 ms 4576 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4448 KB Output is correct
8 Correct 1 ms 4448 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4564 KB Output is correct
11 Correct 160 ms 33936 KB Output is correct
12 Correct 128 ms 24104 KB Output is correct
13 Correct 113 ms 28576 KB Output is correct
14 Correct 200 ms 33676 KB Output is correct
15 Correct 144 ms 33872 KB Output is correct
16 Correct 133 ms 33624 KB Output is correct
17 Correct 2 ms 4556 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 2 ms 4444 KB Output is correct
20 Correct 2 ms 4444 KB Output is correct
21 Correct 2 ms 4956 KB Output is correct
22 Correct 184 ms 34052 KB Output is correct
23 Correct 204 ms 33140 KB Output is correct
24 Correct 183 ms 25676 KB Output is correct
25 Correct 262 ms 34012 KB Output is correct
26 Correct 142 ms 33884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4452 KB Output is correct
3 Correct 1 ms 4448 KB Output is correct
4 Correct 1 ms 4448 KB Output is correct
5 Correct 1 ms 4576 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4448 KB Output is correct
8 Correct 1 ms 4448 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4564 KB Output is correct
11 Correct 160 ms 33936 KB Output is correct
12 Correct 128 ms 24104 KB Output is correct
13 Correct 113 ms 28576 KB Output is correct
14 Correct 200 ms 33676 KB Output is correct
15 Correct 144 ms 33872 KB Output is correct
16 Correct 133 ms 33624 KB Output is correct
17 Correct 2 ms 4556 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 2 ms 4444 KB Output is correct
20 Correct 2 ms 4444 KB Output is correct
21 Correct 2 ms 4956 KB Output is correct
22 Correct 184 ms 34052 KB Output is correct
23 Correct 204 ms 33140 KB Output is correct
24 Correct 183 ms 25676 KB Output is correct
25 Correct 262 ms 34012 KB Output is correct
26 Correct 142 ms 33884 KB Output is correct
27 Correct 1 ms 4560 KB Output is correct
28 Correct 2 ms 4440 KB Output is correct
29 Correct 1 ms 4600 KB Output is correct
30 Correct 1 ms 4440 KB Output is correct
31 Correct 5 ms 5208 KB Output is correct
32 Correct 1 ms 4696 KB Output is correct
33 Correct 1 ms 4700 KB Output is correct
34 Correct 258 ms 32952 KB Output is correct
35 Correct 283 ms 31660 KB Output is correct
36 Correct 313 ms 34384 KB Output is correct
37 Correct 360 ms 34580 KB Output is correct
38 Correct 195 ms 33660 KB Output is correct
39 Correct 85 ms 22628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4452 KB Output is correct
3 Correct 1 ms 4448 KB Output is correct
4 Correct 1 ms 4448 KB Output is correct
5 Correct 1 ms 4576 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4448 KB Output is correct
8 Correct 1 ms 4448 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4564 KB Output is correct
11 Correct 160 ms 33936 KB Output is correct
12 Correct 128 ms 24104 KB Output is correct
13 Correct 113 ms 28576 KB Output is correct
14 Correct 200 ms 33676 KB Output is correct
15 Correct 144 ms 33872 KB Output is correct
16 Correct 133 ms 33624 KB Output is correct
17 Correct 2 ms 4556 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 2 ms 4444 KB Output is correct
20 Correct 2 ms 4444 KB Output is correct
21 Correct 2 ms 4956 KB Output is correct
22 Correct 184 ms 34052 KB Output is correct
23 Correct 204 ms 33140 KB Output is correct
24 Correct 183 ms 25676 KB Output is correct
25 Correct 262 ms 34012 KB Output is correct
26 Correct 142 ms 33884 KB Output is correct
27 Correct 1 ms 4560 KB Output is correct
28 Correct 2 ms 4440 KB Output is correct
29 Correct 1 ms 4600 KB Output is correct
30 Correct 1 ms 4440 KB Output is correct
31 Correct 5 ms 5208 KB Output is correct
32 Correct 1 ms 4696 KB Output is correct
33 Correct 1 ms 4700 KB Output is correct
34 Correct 258 ms 32952 KB Output is correct
35 Correct 283 ms 31660 KB Output is correct
36 Correct 313 ms 34384 KB Output is correct
37 Correct 360 ms 34580 KB Output is correct
38 Correct 195 ms 33660 KB Output is correct
39 Correct 85 ms 22628 KB Output is correct
40 Correct 4 ms 5344 KB Output is correct
41 Correct 4 ms 5212 KB Output is correct
42 Correct 3 ms 5368 KB Output is correct
43 Correct 3 ms 5212 KB Output is correct
44 Correct 313 ms 34852 KB Output is correct
45 Correct 403 ms 35056 KB Output is correct
46 Correct 353 ms 34896 KB Output is correct
47 Correct 410 ms 34896 KB Output is correct
48 Correct 228 ms 34900 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 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4560 KB Output is correct
7 Correct 1 ms 4444 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 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4564 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 4440 KB Output is correct
19 Correct 1 ms 4440 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 4568 KB Output is correct
24 Correct 1 ms 4444 KB Output is correct
25 Correct 1 ms 4444 KB Output is correct
26 Correct 5 ms 5580 KB Output is correct
27 Correct 6 ms 5212 KB Output is correct
28 Correct 6 ms 5212 KB Output is correct
29 Correct 5 ms 5212 KB Output is correct
30 Correct 3 ms 4952 KB Output is correct
31 Correct 4 ms 5212 KB Output is correct
32 Correct 5 ms 5324 KB Output is correct
33 Correct 4 ms 5212 KB Output is correct
34 Correct 5 ms 5444 KB Output is correct
35 Correct 2 ms 4700 KB Output is correct
36 Correct 2 ms 4700 KB Output is correct
37 Correct 3 ms 5212 KB Output is correct
38 Correct 4 ms 5360 KB Output is correct
39 Correct 2 ms 4840 KB Output is correct
40 Correct 1 ms 4444 KB Output is correct
41 Correct 1 ms 4452 KB Output is correct
42 Correct 1 ms 4448 KB Output is correct
43 Correct 1 ms 4448 KB Output is correct
44 Correct 1 ms 4576 KB Output is correct
45 Correct 1 ms 4444 KB Output is correct
46 Correct 1 ms 4448 KB Output is correct
47 Correct 1 ms 4448 KB Output is correct
48 Correct 1 ms 4444 KB Output is correct
49 Correct 1 ms 4564 KB Output is correct
50 Correct 160 ms 33936 KB Output is correct
51 Correct 128 ms 24104 KB Output is correct
52 Correct 113 ms 28576 KB Output is correct
53 Correct 200 ms 33676 KB Output is correct
54 Correct 144 ms 33872 KB Output is correct
55 Correct 133 ms 33624 KB Output is correct
56 Correct 2 ms 4556 KB Output is correct
57 Correct 1 ms 4444 KB Output is correct
58 Correct 2 ms 4444 KB Output is correct
59 Correct 2 ms 4444 KB Output is correct
60 Correct 2 ms 4956 KB Output is correct
61 Correct 184 ms 34052 KB Output is correct
62 Correct 204 ms 33140 KB Output is correct
63 Correct 183 ms 25676 KB Output is correct
64 Correct 262 ms 34012 KB Output is correct
65 Correct 142 ms 33884 KB Output is correct
66 Correct 1 ms 4560 KB Output is correct
67 Correct 2 ms 4440 KB Output is correct
68 Correct 1 ms 4600 KB Output is correct
69 Correct 1 ms 4440 KB Output is correct
70 Correct 5 ms 5208 KB Output is correct
71 Correct 1 ms 4696 KB Output is correct
72 Correct 1 ms 4700 KB Output is correct
73 Correct 258 ms 32952 KB Output is correct
74 Correct 283 ms 31660 KB Output is correct
75 Correct 313 ms 34384 KB Output is correct
76 Correct 360 ms 34580 KB Output is correct
77 Correct 195 ms 33660 KB Output is correct
78 Correct 85 ms 22628 KB Output is correct
79 Correct 4 ms 5344 KB Output is correct
80 Correct 4 ms 5212 KB Output is correct
81 Correct 3 ms 5368 KB Output is correct
82 Correct 3 ms 5212 KB Output is correct
83 Correct 313 ms 34852 KB Output is correct
84 Correct 403 ms 35056 KB Output is correct
85 Correct 353 ms 34896 KB Output is correct
86 Correct 410 ms 34896 KB Output is correct
87 Correct 228 ms 34900 KB Output is correct
88 Correct 297 ms 37096 KB Output is correct
89 Correct 343 ms 36728 KB Output is correct
90 Correct 316 ms 36692 KB Output is correct
91 Correct 380 ms 36812 KB Output is correct
92 Correct 343 ms 35352 KB Output is correct
93 Correct 353 ms 35672 KB Output is correct
94 Correct 397 ms 35412 KB Output is correct
95 Correct 234 ms 36540 KB Output is correct
96 Correct 190 ms 36728 KB Output is correct
97 Correct 156 ms 36920 KB Output is correct
98 Correct 139 ms 35308 KB Output is correct
99 Correct 162 ms 35476 KB Output is correct