Submission #968424

# Submission time Handle Problem Language Result Execution time Memory
968424 2024-04-23T12:10:23 Z Vladth11 Team Contest (JOI22_team) C++14
64 / 100
2000 ms 4796 KB
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"
#define debugs(x) cerr << #x << " " << x << " "
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
 
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pii;
 
const ll NMAX = 150005;
const ll INF = 1e9;
const ll nrbits = 20;
const ll MOD = 998244353;
 
int x[NMAX];
int y[NMAX];
int z[NMAX];
int ok[NMAX];
 
signed main() {
#ifdef HOME
    ifstream cin(".in");
    ofstream cout(".out");
#endif // HOME
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int i, n;
    cin >> n;
    for(i = 1; i <= n; i++){
        cin >> x[i] >> y[i] >> z[i];
    }
    int oke = 1;
    while(oke){
        oke = 0;
        int maxx = 0, maxy = 0, maxz = 0;
        for(i = 1; i <= n; i++){
            if(ok[i] == 1) continue;
            maxx = max(maxx, x[i]);
            maxy = max(maxy, y[i]);
            maxz = max(maxz, z[i]);
        }
        for(i = 1; i <= n; i++){
            int cnt = 0;
            if(ok[i]) continue;
            if(x[i] == maxx) cnt++;
            if(z[i] == maxz) cnt++;
            if(y[i] == maxy) cnt++;
            if(cnt > 1){
                ok[i] = 1;
                oke = 1;
            }
        }
        if(oke == 0){
            int cnt = 0;
            for(i = 1;  i <= n; i++) cnt += !ok[i];
            if(cnt >= 3){
                cout << maxx + maxy + maxz << "\n";
            }else{
                cout << "-1";
            }
            return 0;
        }
    }
    cout << "-1";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2392 KB Output is correct
25 Correct 1 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2392 KB Output is correct
25 Correct 1 ms 2392 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 12 ms 2640 KB Output is correct
28 Correct 23 ms 2396 KB Output is correct
29 Correct 39 ms 2612 KB Output is correct
30 Correct 14 ms 2396 KB Output is correct
31 Correct 10 ms 2580 KB Output is correct
32 Correct 6 ms 2396 KB Output is correct
33 Correct 2 ms 2396 KB Output is correct
34 Correct 62 ms 2392 KB Output is correct
35 Correct 1 ms 2396 KB Output is correct
36 Correct 2 ms 2396 KB Output is correct
37 Correct 1 ms 2568 KB Output is correct
38 Correct 20 ms 2580 KB Output is correct
39 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2508 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2512 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 20 ms 3652 KB Output is correct
12 Correct 16 ms 3160 KB Output is correct
13 Correct 20 ms 3420 KB Output is correct
14 Correct 23 ms 3652 KB Output is correct
15 Correct 18 ms 3652 KB Output is correct
16 Correct 18 ms 3672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2508 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2512 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 20 ms 3652 KB Output is correct
12 Correct 16 ms 3160 KB Output is correct
13 Correct 20 ms 3420 KB Output is correct
14 Correct 23 ms 3652 KB Output is correct
15 Correct 18 ms 3652 KB Output is correct
16 Correct 18 ms 3672 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 21 ms 3904 KB Output is correct
23 Correct 43 ms 3516 KB Output is correct
24 Correct 43 ms 3464 KB Output is correct
25 Correct 49 ms 3932 KB Output is correct
26 Correct 19 ms 3676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2508 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2512 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 20 ms 3652 KB Output is correct
12 Correct 16 ms 3160 KB Output is correct
13 Correct 20 ms 3420 KB Output is correct
14 Correct 23 ms 3652 KB Output is correct
15 Correct 18 ms 3652 KB Output is correct
16 Correct 18 ms 3672 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 21 ms 3904 KB Output is correct
23 Correct 43 ms 3516 KB Output is correct
24 Correct 43 ms 3464 KB Output is correct
25 Correct 49 ms 3932 KB Output is correct
26 Correct 19 ms 3676 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 6 ms 2396 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 2 ms 2396 KB Output is correct
34 Correct 22 ms 4164 KB Output is correct
35 Correct 281 ms 4160 KB Output is correct
36 Correct 380 ms 4180 KB Output is correct
37 Correct 326 ms 4432 KB Output is correct
38 Correct 22 ms 4180 KB Output is correct
39 Correct 75 ms 3664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2508 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2512 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 20 ms 3652 KB Output is correct
12 Correct 16 ms 3160 KB Output is correct
13 Correct 20 ms 3420 KB Output is correct
14 Correct 23 ms 3652 KB Output is correct
15 Correct 18 ms 3652 KB Output is correct
16 Correct 18 ms 3672 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 21 ms 3904 KB Output is correct
23 Correct 43 ms 3516 KB Output is correct
24 Correct 43 ms 3464 KB Output is correct
25 Correct 49 ms 3932 KB Output is correct
26 Correct 19 ms 3676 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 6 ms 2396 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 2 ms 2396 KB Output is correct
34 Correct 22 ms 4164 KB Output is correct
35 Correct 281 ms 4160 KB Output is correct
36 Correct 380 ms 4180 KB Output is correct
37 Correct 326 ms 4432 KB Output is correct
38 Correct 22 ms 4180 KB Output is correct
39 Correct 75 ms 3664 KB Output is correct
40 Correct 14 ms 2532 KB Output is correct
41 Correct 9 ms 2392 KB Output is correct
42 Correct 1 ms 2396 KB Output is correct
43 Correct 20 ms 2396 KB Output is correct
44 Correct 25 ms 4796 KB Output is correct
45 Execution timed out 2061 ms 4700 KB Time limit exceeded
46 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2392 KB Output is correct
25 Correct 1 ms 2392 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 12 ms 2640 KB Output is correct
28 Correct 23 ms 2396 KB Output is correct
29 Correct 39 ms 2612 KB Output is correct
30 Correct 14 ms 2396 KB Output is correct
31 Correct 10 ms 2580 KB Output is correct
32 Correct 6 ms 2396 KB Output is correct
33 Correct 2 ms 2396 KB Output is correct
34 Correct 62 ms 2392 KB Output is correct
35 Correct 1 ms 2396 KB Output is correct
36 Correct 2 ms 2396 KB Output is correct
37 Correct 1 ms 2568 KB Output is correct
38 Correct 20 ms 2580 KB Output is correct
39 Correct 1 ms 2396 KB Output is correct
40 Correct 1 ms 2508 KB Output is correct
41 Correct 1 ms 2396 KB Output is correct
42 Correct 0 ms 2396 KB Output is correct
43 Correct 1 ms 2396 KB Output is correct
44 Correct 1 ms 2396 KB Output is correct
45 Correct 1 ms 2512 KB Output is correct
46 Correct 1 ms 2396 KB Output is correct
47 Correct 1 ms 2396 KB Output is correct
48 Correct 1 ms 2392 KB Output is correct
49 Correct 1 ms 2396 KB Output is correct
50 Correct 20 ms 3652 KB Output is correct
51 Correct 16 ms 3160 KB Output is correct
52 Correct 20 ms 3420 KB Output is correct
53 Correct 23 ms 3652 KB Output is correct
54 Correct 18 ms 3652 KB Output is correct
55 Correct 18 ms 3672 KB Output is correct
56 Correct 1 ms 2396 KB Output is correct
57 Correct 1 ms 2396 KB Output is correct
58 Correct 1 ms 2396 KB Output is correct
59 Correct 1 ms 2396 KB Output is correct
60 Correct 1 ms 2396 KB Output is correct
61 Correct 21 ms 3904 KB Output is correct
62 Correct 43 ms 3516 KB Output is correct
63 Correct 43 ms 3464 KB Output is correct
64 Correct 49 ms 3932 KB Output is correct
65 Correct 19 ms 3676 KB Output is correct
66 Correct 1 ms 2396 KB Output is correct
67 Correct 1 ms 2396 KB Output is correct
68 Correct 1 ms 2396 KB Output is correct
69 Correct 1 ms 2396 KB Output is correct
70 Correct 6 ms 2396 KB Output is correct
71 Correct 1 ms 2396 KB Output is correct
72 Correct 2 ms 2396 KB Output is correct
73 Correct 22 ms 4164 KB Output is correct
74 Correct 281 ms 4160 KB Output is correct
75 Correct 380 ms 4180 KB Output is correct
76 Correct 326 ms 4432 KB Output is correct
77 Correct 22 ms 4180 KB Output is correct
78 Correct 75 ms 3664 KB Output is correct
79 Correct 14 ms 2532 KB Output is correct
80 Correct 9 ms 2392 KB Output is correct
81 Correct 1 ms 2396 KB Output is correct
82 Correct 20 ms 2396 KB Output is correct
83 Correct 25 ms 4796 KB Output is correct
84 Execution timed out 2061 ms 4700 KB Time limit exceeded
85 Halted 0 ms 0 KB -