# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
768394 | 2023-06-28T04:50:47 Z | nguyentunglam | Team Contest (JOI22_team) | C++17 | 2000 ms | 4336 KB |
#include<bits/stdc++.h> #define fi first #define se second #define endl "\n" #define ii pair<int, int> using namespace std; const int N = 2e5 + 10; int a[3][N], mx[3]; bool ban[N]; int main() { #define task "" cin.tie(0) -> sync_with_stdio(0); if (fopen ("task.inp", "r")) { freopen ("task.inp", "r", stdin); freopen ("task.out", "w", stdout); } if (fopen (task".inp", "r")) { freopen (task".inp", "r", stdin); freopen (task".out", "w", stdout); } int n; cin >> n; for(int i = 1; i <= n; i++) for(int j = 0; j < 3; j++) cin >> a[j][i]; int cur = n; while (cur >= 3) { mx[0] = mx[1] = mx[2] = 0; for(int i = 1; i <= n; i++) for(int j = 0; j < 3; j++) if (!ban[i]) mx[j] = max(mx[j], a[j][i]); bool stop = 1; for(int i = 1; i <= n; i++) if (!ban[i]) { int same = 0; for(int j = 0; j < 3; j++) same += mx[j] == a[j][i]; if (same >= 2) ban[i] = 1, stop = 0, cur--; } if (stop) { // for(int i = 1; i <= n; i++) cout << ban[i] << endl; cout << mx[0] + mx[1] + mx[2]; return 0; } } cout << -1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 0 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 0 ms | 340 KB | Output is correct |
14 | Correct | 0 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 | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 328 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 328 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 328 KB | Output is correct |
24 | Correct | 1 ms | 332 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 0 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 0 ms | 340 KB | Output is correct |
14 | Correct | 0 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 | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 328 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 328 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 328 KB | Output is correct |
24 | Correct | 1 ms | 332 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 468 KB | Output is correct |
27 | Correct | 12 ms | 496 KB | Output is correct |
28 | Correct | 29 ms | 456 KB | Output is correct |
29 | Correct | 59 ms | 480 KB | Output is correct |
30 | Correct | 19 ms | 340 KB | Output is correct |
31 | Correct | 9 ms | 444 KB | Output is correct |
32 | Correct | 9 ms | 340 KB | Output is correct |
33 | Correct | 1 ms | 476 KB | Output is correct |
34 | Correct | 96 ms | 468 KB | Output is correct |
35 | Correct | 1 ms | 340 KB | Output is correct |
36 | Correct | 2 ms | 340 KB | Output is correct |
37 | Correct | 1 ms | 340 KB | Output is correct |
38 | Correct | 24 ms | 340 KB | Output is correct |
39 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 0 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 328 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 0 ms | 332 KB | Output is correct |
11 | Correct | 25 ms | 3016 KB | Output is correct |
12 | Correct | 20 ms | 2132 KB | Output is correct |
13 | Correct | 20 ms | 2584 KB | Output is correct |
14 | Correct | 27 ms | 3092 KB | Output is correct |
15 | Correct | 19 ms | 3104 KB | Output is correct |
16 | Correct | 19 ms | 3036 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 0 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 328 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 0 ms | 332 KB | Output is correct |
11 | Correct | 25 ms | 3016 KB | Output is correct |
12 | Correct | 20 ms | 2132 KB | Output is correct |
13 | Correct | 20 ms | 2584 KB | Output is correct |
14 | Correct | 27 ms | 3092 KB | Output is correct |
15 | Correct | 19 ms | 3104 KB | Output is correct |
16 | Correct | 19 ms | 3036 KB | Output is correct |
17 | Correct | 0 ms | 340 KB | Output is correct |
18 | Correct | 0 ms | 352 KB | Output is correct |
19 | Correct | 1 ms | 328 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 22 ms | 3356 KB | Output is correct |
23 | Correct | 46 ms | 3116 KB | Output is correct |
24 | Correct | 49 ms | 2480 KB | Output is correct |
25 | Correct | 66 ms | 3256 KB | Output is correct |
26 | Correct | 19 ms | 3164 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 0 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 328 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 0 ms | 332 KB | Output is correct |
11 | Correct | 25 ms | 3016 KB | Output is correct |
12 | Correct | 20 ms | 2132 KB | Output is correct |
13 | Correct | 20 ms | 2584 KB | Output is correct |
14 | Correct | 27 ms | 3092 KB | Output is correct |
15 | Correct | 19 ms | 3104 KB | Output is correct |
16 | Correct | 19 ms | 3036 KB | Output is correct |
17 | Correct | 0 ms | 340 KB | Output is correct |
18 | Correct | 0 ms | 352 KB | Output is correct |
19 | Correct | 1 ms | 328 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 22 ms | 3356 KB | Output is correct |
23 | Correct | 46 ms | 3116 KB | Output is correct |
24 | Correct | 49 ms | 2480 KB | Output is correct |
25 | Correct | 66 ms | 3256 KB | Output is correct |
26 | Correct | 19 ms | 3164 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 1 ms | 340 KB | Output is correct |
29 | Correct | 0 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 332 KB | Output is correct |
31 | Correct | 9 ms | 340 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 2 ms | 336 KB | Output is correct |
34 | Correct | 25 ms | 3488 KB | Output is correct |
35 | Correct | 352 ms | 3600 KB | Output is correct |
36 | Correct | 484 ms | 3764 KB | Output is correct |
37 | Correct | 499 ms | 3888 KB | Output is correct |
38 | Correct | 22 ms | 3728 KB | Output is correct |
39 | Correct | 106 ms | 2396 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 0 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 328 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 0 ms | 332 KB | Output is correct |
11 | Correct | 25 ms | 3016 KB | Output is correct |
12 | Correct | 20 ms | 2132 KB | Output is correct |
13 | Correct | 20 ms | 2584 KB | Output is correct |
14 | Correct | 27 ms | 3092 KB | Output is correct |
15 | Correct | 19 ms | 3104 KB | Output is correct |
16 | Correct | 19 ms | 3036 KB | Output is correct |
17 | Correct | 0 ms | 340 KB | Output is correct |
18 | Correct | 0 ms | 352 KB | Output is correct |
19 | Correct | 1 ms | 328 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 22 ms | 3356 KB | Output is correct |
23 | Correct | 46 ms | 3116 KB | Output is correct |
24 | Correct | 49 ms | 2480 KB | Output is correct |
25 | Correct | 66 ms | 3256 KB | Output is correct |
26 | Correct | 19 ms | 3164 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 1 ms | 340 KB | Output is correct |
29 | Correct | 0 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 332 KB | Output is correct |
31 | Correct | 9 ms | 340 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 2 ms | 336 KB | Output is correct |
34 | Correct | 25 ms | 3488 KB | Output is correct |
35 | Correct | 352 ms | 3600 KB | Output is correct |
36 | Correct | 484 ms | 3764 KB | Output is correct |
37 | Correct | 499 ms | 3888 KB | Output is correct |
38 | Correct | 22 ms | 3728 KB | Output is correct |
39 | Correct | 106 ms | 2396 KB | Output is correct |
40 | Correct | 22 ms | 340 KB | Output is correct |
41 | Correct | 12 ms | 468 KB | Output is correct |
42 | Correct | 1 ms | 340 KB | Output is correct |
43 | Correct | 25 ms | 404 KB | Output is correct |
44 | Correct | 25 ms | 4044 KB | Output is correct |
45 | Execution timed out | 2068 ms | 4336 KB | Time limit exceeded |
46 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 0 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 0 ms | 340 KB | Output is correct |
14 | Correct | 0 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 | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 328 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 328 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 328 KB | Output is correct |
24 | Correct | 1 ms | 332 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 468 KB | Output is correct |
27 | Correct | 12 ms | 496 KB | Output is correct |
28 | Correct | 29 ms | 456 KB | Output is correct |
29 | Correct | 59 ms | 480 KB | Output is correct |
30 | Correct | 19 ms | 340 KB | Output is correct |
31 | Correct | 9 ms | 444 KB | Output is correct |
32 | Correct | 9 ms | 340 KB | Output is correct |
33 | Correct | 1 ms | 476 KB | Output is correct |
34 | Correct | 96 ms | 468 KB | Output is correct |
35 | Correct | 1 ms | 340 KB | Output is correct |
36 | Correct | 2 ms | 340 KB | Output is correct |
37 | Correct | 1 ms | 340 KB | Output is correct |
38 | Correct | 24 ms | 340 KB | Output is correct |
39 | Correct | 1 ms | 340 KB | Output is correct |
40 | Correct | 0 ms | 340 KB | Output is correct |
41 | Correct | 1 ms | 332 KB | Output is correct |
42 | Correct | 1 ms | 340 KB | Output is correct |
43 | Correct | 0 ms | 340 KB | Output is correct |
44 | Correct | 1 ms | 340 KB | Output is correct |
45 | Correct | 1 ms | 340 KB | Output is correct |
46 | Correct | 0 ms | 340 KB | Output is correct |
47 | Correct | 1 ms | 328 KB | Output is correct |
48 | Correct | 1 ms | 340 KB | Output is correct |
49 | Correct | 0 ms | 332 KB | Output is correct |
50 | Correct | 25 ms | 3016 KB | Output is correct |
51 | Correct | 20 ms | 2132 KB | Output is correct |
52 | Correct | 20 ms | 2584 KB | Output is correct |
53 | Correct | 27 ms | 3092 KB | Output is correct |
54 | Correct | 19 ms | 3104 KB | Output is correct |
55 | Correct | 19 ms | 3036 KB | Output is correct |
56 | Correct | 0 ms | 340 KB | Output is correct |
57 | Correct | 0 ms | 352 KB | Output is correct |
58 | Correct | 1 ms | 328 KB | Output is correct |
59 | Correct | 1 ms | 340 KB | Output is correct |
60 | Correct | 1 ms | 340 KB | Output is correct |
61 | Correct | 22 ms | 3356 KB | Output is correct |
62 | Correct | 46 ms | 3116 KB | Output is correct |
63 | Correct | 49 ms | 2480 KB | Output is correct |
64 | Correct | 66 ms | 3256 KB | Output is correct |
65 | Correct | 19 ms | 3164 KB | Output is correct |
66 | Correct | 1 ms | 340 KB | Output is correct |
67 | Correct | 1 ms | 340 KB | Output is correct |
68 | Correct | 0 ms | 340 KB | Output is correct |
69 | Correct | 1 ms | 332 KB | Output is correct |
70 | Correct | 9 ms | 340 KB | Output is correct |
71 | Correct | 1 ms | 340 KB | Output is correct |
72 | Correct | 2 ms | 336 KB | Output is correct |
73 | Correct | 25 ms | 3488 KB | Output is correct |
74 | Correct | 352 ms | 3600 KB | Output is correct |
75 | Correct | 484 ms | 3764 KB | Output is correct |
76 | Correct | 499 ms | 3888 KB | Output is correct |
77 | Correct | 22 ms | 3728 KB | Output is correct |
78 | Correct | 106 ms | 2396 KB | Output is correct |
79 | Correct | 22 ms | 340 KB | Output is correct |
80 | Correct | 12 ms | 468 KB | Output is correct |
81 | Correct | 1 ms | 340 KB | Output is correct |
82 | Correct | 25 ms | 404 KB | Output is correct |
83 | Correct | 25 ms | 4044 KB | Output is correct |
84 | Execution timed out | 2068 ms | 4336 KB | Time limit exceeded |
85 | Halted | 0 ms | 0 KB | - |