# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
918597 | 2024-01-30T07:19:20 Z | manishjha91 | Team Contest (JOI22_team) | C++17 | 290 ms | 16556 KB |
#include<bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using lld = long double; const int inf = 1e9; // #ifndef ONLINE_JUDGE // #include "E:\Personal\cpp_codes\debugalgo.h" // #else // #define debug(x) // #endif void solve() { int n; cin >> n; vector<array<int,3>> a(n); int mxx = 0, mxy = 0, mxz = 0; for (int i = 0; i < n; i++) { cin >> a[i][0]>>a[i][1]>>a[i][2]; } priority_queue<pair<int,int>> pq[3]; set<int> banned; for(int i=0; i<n; i++) { for(int j=0; j<3; j++) { pq[j].push({a[i][j],i}); } } int ans = -1; while(!pq[0].empty() && !pq[1].empty() && !pq[1].empty()) { for(int j=0; j<3; j++) { while(!pq[j].empty() && banned.count(pq[j].top().second)) { pq[j].pop(); } } if(pq[0].empty() || pq[1].empty() || pq[1].empty()) break; int mxx = pq[0].top().first; int mxy = pq[1].top().first; int mxz = pq[2].top().first; if(a[pq[0].top().second][1]>=mxy || a[pq[0].top().second][2]>=mxz) { banned.insert(pq[0].top().second); continue; } if(a[pq[1].top().second][2]>=mxz || a[pq[1].top().second][0]>=mxx) { banned.insert(pq[1].top().second); continue; } if(a[pq[2].top().second][1]>=mxy || a[pq[2].top().second][0]>=mxx) { banned.insert(pq[2].top().second); continue; } ans = max(ans,mxx + mxy + mxz); break; } cout<<ans<<"\n"; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); // #ifndef ONLINE_JUDGE // freopen("error.txt", "w", stderr); // #endif int tt = 1; // cin >> tt; while (tt--) { solve(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 604 KB | Output is correct |
15 | Correct | 1 ms | 348 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 1 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 452 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 344 KB | Output is correct |
22 | Correct | 1 ms | 344 KB | Output is correct |
23 | Correct | 1 ms | 348 KB | Output is correct |
24 | Correct | 0 ms | 348 KB | Output is correct |
25 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 604 KB | Output is correct |
15 | Correct | 1 ms | 348 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 1 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 452 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 344 KB | Output is correct |
22 | Correct | 1 ms | 344 KB | Output is correct |
23 | Correct | 1 ms | 348 KB | Output is correct |
24 | Correct | 0 ms | 348 KB | Output is correct |
25 | Correct | 1 ms | 348 KB | Output is correct |
26 | Correct | 2 ms | 604 KB | Output is correct |
27 | Correct | 2 ms | 604 KB | Output is correct |
28 | Correct | 3 ms | 604 KB | Output is correct |
29 | Correct | 5 ms | 860 KB | Output is correct |
30 | Correct | 3 ms | 856 KB | Output is correct |
31 | Correct | 2 ms | 604 KB | Output is correct |
32 | Correct | 4 ms | 600 KB | Output is correct |
33 | Correct | 4 ms | 860 KB | Output is correct |
34 | Correct | 4 ms | 860 KB | Output is correct |
35 | Correct | 1 ms | 348 KB | Output is correct |
36 | Correct | 1 ms | 348 KB | Output is correct |
37 | Correct | 1 ms | 604 KB | Output is correct |
38 | Correct | 3 ms | 600 KB | Output is correct |
39 | Correct | 1 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 456 KB | Output is correct |
4 | Correct | 0 ms | 352 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 452 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 34 ms | 7184 KB | Output is correct |
12 | Correct | 62 ms | 7868 KB | Output is correct |
13 | Correct | 31 ms | 6076 KB | Output is correct |
14 | Correct | 140 ms | 13568 KB | Output is correct |
15 | Correct | 166 ms | 13488 KB | Output is correct |
16 | Correct | 143 ms | 13484 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 456 KB | Output is correct |
4 | Correct | 0 ms | 352 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 452 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 34 ms | 7184 KB | Output is correct |
12 | Correct | 62 ms | 7868 KB | Output is correct |
13 | Correct | 31 ms | 6076 KB | Output is correct |
14 | Correct | 140 ms | 13568 KB | Output is correct |
15 | Correct | 166 ms | 13488 KB | Output is correct |
16 | Correct | 143 ms | 13484 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 35 ms | 7432 KB | Output is correct |
23 | Correct | 50 ms | 7852 KB | Output is correct |
24 | Correct | 75 ms | 8636 KB | Output is correct |
25 | Correct | 150 ms | 13736 KB | Output is correct |
26 | Correct | 165 ms | 13712 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 456 KB | Output is correct |
4 | Correct | 0 ms | 352 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 452 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 34 ms | 7184 KB | Output is correct |
12 | Correct | 62 ms | 7868 KB | Output is correct |
13 | Correct | 31 ms | 6076 KB | Output is correct |
14 | Correct | 140 ms | 13568 KB | Output is correct |
15 | Correct | 166 ms | 13488 KB | Output is correct |
16 | Correct | 143 ms | 13484 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 35 ms | 7432 KB | Output is correct |
23 | Correct | 50 ms | 7852 KB | Output is correct |
24 | Correct | 75 ms | 8636 KB | Output is correct |
25 | Correct | 150 ms | 13736 KB | Output is correct |
26 | Correct | 165 ms | 13712 KB | Output is correct |
27 | Correct | 0 ms | 348 KB | Output is correct |
28 | Correct | 0 ms | 348 KB | Output is correct |
29 | Correct | 0 ms | 348 KB | Output is correct |
30 | Correct | 1 ms | 344 KB | Output is correct |
31 | Correct | 4 ms | 604 KB | Output is correct |
32 | Correct | 1 ms | 348 KB | Output is correct |
33 | Correct | 1 ms | 348 KB | Output is correct |
34 | Correct | 34 ms | 7884 KB | Output is correct |
35 | Correct | 78 ms | 8928 KB | Output is correct |
36 | Correct | 87 ms | 9900 KB | Output is correct |
37 | Correct | 199 ms | 14272 KB | Output is correct |
38 | Correct | 202 ms | 14016 KB | Output is correct |
39 | Correct | 101 ms | 8636 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 456 KB | Output is correct |
4 | Correct | 0 ms | 352 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 452 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 34 ms | 7184 KB | Output is correct |
12 | Correct | 62 ms | 7868 KB | Output is correct |
13 | Correct | 31 ms | 6076 KB | Output is correct |
14 | Correct | 140 ms | 13568 KB | Output is correct |
15 | Correct | 166 ms | 13488 KB | Output is correct |
16 | Correct | 143 ms | 13484 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 35 ms | 7432 KB | Output is correct |
23 | Correct | 50 ms | 7852 KB | Output is correct |
24 | Correct | 75 ms | 8636 KB | Output is correct |
25 | Correct | 150 ms | 13736 KB | Output is correct |
26 | Correct | 165 ms | 13712 KB | Output is correct |
27 | Correct | 0 ms | 348 KB | Output is correct |
28 | Correct | 0 ms | 348 KB | Output is correct |
29 | Correct | 0 ms | 348 KB | Output is correct |
30 | Correct | 1 ms | 344 KB | Output is correct |
31 | Correct | 4 ms | 604 KB | Output is correct |
32 | Correct | 1 ms | 348 KB | Output is correct |
33 | Correct | 1 ms | 348 KB | Output is correct |
34 | Correct | 34 ms | 7884 KB | Output is correct |
35 | Correct | 78 ms | 8928 KB | Output is correct |
36 | Correct | 87 ms | 9900 KB | Output is correct |
37 | Correct | 199 ms | 14272 KB | Output is correct |
38 | Correct | 202 ms | 14016 KB | Output is correct |
39 | Correct | 101 ms | 8636 KB | Output is correct |
40 | Correct | 2 ms | 604 KB | Output is correct |
41 | Correct | 2 ms | 604 KB | Output is correct |
42 | Correct | 1 ms | 604 KB | Output is correct |
43 | Correct | 3 ms | 720 KB | Output is correct |
44 | Correct | 45 ms | 8324 KB | Output is correct |
45 | Correct | 175 ms | 14256 KB | Output is correct |
46 | Correct | 182 ms | 12200 KB | Output is correct |
47 | Correct | 226 ms | 14764 KB | Output is correct |
48 | Correct | 174 ms | 14764 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 604 KB | Output is correct |
15 | Correct | 1 ms | 348 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 1 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 452 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 344 KB | Output is correct |
22 | Correct | 1 ms | 344 KB | Output is correct |
23 | Correct | 1 ms | 348 KB | Output is correct |
24 | Correct | 0 ms | 348 KB | Output is correct |
25 | Correct | 1 ms | 348 KB | Output is correct |
26 | Correct | 2 ms | 604 KB | Output is correct |
27 | Correct | 2 ms | 604 KB | Output is correct |
28 | Correct | 3 ms | 604 KB | Output is correct |
29 | Correct | 5 ms | 860 KB | Output is correct |
30 | Correct | 3 ms | 856 KB | Output is correct |
31 | Correct | 2 ms | 604 KB | Output is correct |
32 | Correct | 4 ms | 600 KB | Output is correct |
33 | Correct | 4 ms | 860 KB | Output is correct |
34 | Correct | 4 ms | 860 KB | Output is correct |
35 | Correct | 1 ms | 348 KB | Output is correct |
36 | Correct | 1 ms | 348 KB | Output is correct |
37 | Correct | 1 ms | 604 KB | Output is correct |
38 | Correct | 3 ms | 600 KB | Output is correct |
39 | Correct | 1 ms | 344 KB | Output is correct |
40 | Correct | 1 ms | 348 KB | Output is correct |
41 | Correct | 0 ms | 344 KB | Output is correct |
42 | Correct | 0 ms | 456 KB | Output is correct |
43 | Correct | 0 ms | 352 KB | Output is correct |
44 | Correct | 1 ms | 344 KB | Output is correct |
45 | Correct | 0 ms | 348 KB | Output is correct |
46 | Correct | 1 ms | 452 KB | Output is correct |
47 | Correct | 1 ms | 348 KB | Output is correct |
48 | Correct | 1 ms | 348 KB | Output is correct |
49 | Correct | 0 ms | 348 KB | Output is correct |
50 | Correct | 34 ms | 7184 KB | Output is correct |
51 | Correct | 62 ms | 7868 KB | Output is correct |
52 | Correct | 31 ms | 6076 KB | Output is correct |
53 | Correct | 140 ms | 13568 KB | Output is correct |
54 | Correct | 166 ms | 13488 KB | Output is correct |
55 | Correct | 143 ms | 13484 KB | Output is correct |
56 | Correct | 0 ms | 348 KB | Output is correct |
57 | Correct | 1 ms | 348 KB | Output is correct |
58 | Correct | 0 ms | 348 KB | Output is correct |
59 | Correct | 1 ms | 348 KB | Output is correct |
60 | Correct | 1 ms | 348 KB | Output is correct |
61 | Correct | 35 ms | 7432 KB | Output is correct |
62 | Correct | 50 ms | 7852 KB | Output is correct |
63 | Correct | 75 ms | 8636 KB | Output is correct |
64 | Correct | 150 ms | 13736 KB | Output is correct |
65 | Correct | 165 ms | 13712 KB | Output is correct |
66 | Correct | 0 ms | 348 KB | Output is correct |
67 | Correct | 0 ms | 348 KB | Output is correct |
68 | Correct | 0 ms | 348 KB | Output is correct |
69 | Correct | 1 ms | 344 KB | Output is correct |
70 | Correct | 4 ms | 604 KB | Output is correct |
71 | Correct | 1 ms | 348 KB | Output is correct |
72 | Correct | 1 ms | 348 KB | Output is correct |
73 | Correct | 34 ms | 7884 KB | Output is correct |
74 | Correct | 78 ms | 8928 KB | Output is correct |
75 | Correct | 87 ms | 9900 KB | Output is correct |
76 | Correct | 199 ms | 14272 KB | Output is correct |
77 | Correct | 202 ms | 14016 KB | Output is correct |
78 | Correct | 101 ms | 8636 KB | Output is correct |
79 | Correct | 2 ms | 604 KB | Output is correct |
80 | Correct | 2 ms | 604 KB | Output is correct |
81 | Correct | 1 ms | 604 KB | Output is correct |
82 | Correct | 3 ms | 720 KB | Output is correct |
83 | Correct | 45 ms | 8324 KB | Output is correct |
84 | Correct | 175 ms | 14256 KB | Output is correct |
85 | Correct | 182 ms | 12200 KB | Output is correct |
86 | Correct | 226 ms | 14764 KB | Output is correct |
87 | Correct | 174 ms | 14764 KB | Output is correct |
88 | Correct | 53 ms | 10168 KB | Output is correct |
89 | Correct | 138 ms | 13736 KB | Output is correct |
90 | Correct | 55 ms | 10172 KB | Output is correct |
91 | Correct | 290 ms | 16532 KB | Output is correct |
92 | Correct | 83 ms | 10164 KB | Output is correct |
93 | Correct | 174 ms | 14000 KB | Output is correct |
94 | Correct | 254 ms | 15212 KB | Output is correct |
95 | Correct | 192 ms | 16540 KB | Output is correct |
96 | Correct | 192 ms | 16556 KB | Output is correct |
97 | Correct | 165 ms | 16556 KB | Output is correct |
98 | Correct | 51 ms | 8880 KB | Output is correct |
99 | Correct | 168 ms | 15208 KB | Output is correct |