Submission #892180

# Submission time Handle Problem Language Result Execution time Memory
892180 2023-12-25T03:28:21 Z vjudge1 Team Contest (JOI22_team) C++17
8 / 100
68 ms 4688 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second

const long long INF = 1e18;
const int N = 1e5 + 1;

signed main(){
	
	int n;
	cin >> n;
	int x[n],y[n],z[n];
	for(int i = 0;i < n;i++){
		cin >> x[i] >> y[i] >> z[i];
	}
	if(n <= 300){
		int ans = -1;
		for(int i = 0;i < n;i++){
			for(int j = 0;j < n;j++){
				for(int k = 0;k < n;k++){
					if(i != j && i != k && j != k){
						if(x[i] > x[j] && x[i] > x[k] && y[j] > y[i] && y[j] > y[k] && z[k] > z[i] && z[k] > z[j]){
							ans = max(ans,x[i] + y[j] + z[k]);
						}
					}
				}
			}
		}
		cout << ans;
	} else{
		int cnt[6][6][6] {};
		for(int i = 0;i < n;i++){
			cnt[x[i]][y[i]][z[i]]++;
		}
		vector<pair<pair<int,int>,int>> g;
		for(int x1 = 1;x1 <= 5;x1++){
			for(int y1 = 1;y1 <= 5;y1++){
				for(int z1 = 1;z1 <= 5;z1++){
//					if(x1)
					g.pb({{x1,y1},z1});
				}
			}
		}
		int ans = 0;
		for(int i = 0;i < g.size();i++){
			for(int j = 0;j < g.size();j++){
				for(int k = 0;k < g.size();k++){
//					auto [a,b] = g[i];
//					auto [h,q] = 
					auto [ai,bi] = g[i];
					auto [aj,bj] = g[j];
					auto [ak,bk] = g[k];
					if(ai.ff > aj.ff && ai.ff > ak.ff && aj.ss > ai.ss && aj.ss > ak.ss && bk > bi && bk > bj){
						
					} else{
						continue;
					}
					int x1 = g[i].ff.ff,y1 = g[i].ff.ss,z1 = g[i].ss;
					if(cnt[x1][y1][z1] > 0){
						cnt[x1][y1][z1]--;
					} else{
						continue;
					}
					x1 = g[j].ff.ff,y1 = g[j].ff.ss,z1 = g[j].ss;
					if(cnt[x1][y1][z1] > 0){
						cnt[x1][y1][z1]--;
					} else{
						x1 = g[i].ff.ff,y1 = g[i].ff.ss,z1 = g[i].ss;
						cnt[x1][y1][z1]++;
						continue;
					}
					x1 = g[k].ff.ff,y1 = g[k].ff.ss,z1 = g[k].ss;
					if(cnt[x1][y1][z1] > 0){
						cnt[x1][y1][z1]--;
					} else{
						x1 = g[i].ff.ff,y1 = g[i].ff.ss,z1 = g[i].ss;
						cnt[x1][y1][z1]++;
						x1 = g[j].ff.ff,y1 = g[j].ff.ss,z1 = g[j].ss;
						cnt[x1][y1][z1]++;
						continue;
					}
					x1 = g[i].ff.ff,y1 = g[i].ff.ss,z1 = g[i].ss;
					cnt[x1][y1][z1]++;
					x1 = g[j].ff.ff,y1 = g[j].ff.ss,z1 = g[j].ss;
					cnt[x1][y1][z1]++;
					x1 = g[k].ff.ff,y1 = g[k].ff.ss,z1 = g[k].ss;
					cnt[x1][y1][z1]++;
					
					ans = max(ans,ai.ff + aj.ss + bk);
				}
			}
		}
		cout << ans;
	}
	
}

Compilation message

team.cpp: In function 'int main()':
team.cpp:51:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<std::pair<long long int, long long int>, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |   for(int i = 0;i < g.size();i++){
      |                 ~~^~~~~~~~~~
team.cpp:52:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<std::pair<long long int, long long int>, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |    for(int j = 0;j < g.size();j++){
      |                  ~~^~~~~~~~~~
team.cpp:53:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<std::pair<long long int, long long int>, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |     for(int k = 0;k < g.size();k++){
      |                   ~~^~~~~~~~~~
# Verdict Execution time Memory 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 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 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 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 67 ms 348 KB Output is correct
15 Correct 30 ms 348 KB Output is correct
16 Correct 44 ms 348 KB Output is correct
17 Correct 58 ms 348 KB Output is correct
18 Correct 53 ms 344 KB Output is correct
19 Correct 68 ms 416 KB Output is correct
20 Correct 53 ms 344 KB Output is correct
21 Correct 39 ms 344 KB Output is correct
22 Correct 46 ms 344 KB Output is correct
23 Correct 36 ms 344 KB Output is correct
24 Correct 42 ms 592 KB Output is correct
25 Correct 43 ms 412 KB Output is correct
# Verdict Execution time Memory 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 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 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 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 67 ms 348 KB Output is correct
15 Correct 30 ms 348 KB Output is correct
16 Correct 44 ms 348 KB Output is correct
17 Correct 58 ms 348 KB Output is correct
18 Correct 53 ms 344 KB Output is correct
19 Correct 68 ms 416 KB Output is correct
20 Correct 53 ms 344 KB Output is correct
21 Correct 39 ms 344 KB Output is correct
22 Correct 46 ms 344 KB Output is correct
23 Correct 36 ms 344 KB Output is correct
24 Correct 42 ms 592 KB Output is correct
25 Correct 43 ms 412 KB Output is correct
26 Runtime error 4 ms 604 KB Execution killed with signal 7
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 51 ms 3932 KB Output is correct
12 Correct 35 ms 3156 KB Output is correct
13 Correct 42 ms 3676 KB Output is correct
14 Incorrect 50 ms 4688 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 51 ms 3932 KB Output is correct
12 Correct 35 ms 3156 KB Output is correct
13 Correct 42 ms 3676 KB Output is correct
14 Incorrect 50 ms 4688 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 51 ms 3932 KB Output is correct
12 Correct 35 ms 3156 KB Output is correct
13 Correct 42 ms 3676 KB Output is correct
14 Incorrect 50 ms 4688 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 51 ms 3932 KB Output is correct
12 Correct 35 ms 3156 KB Output is correct
13 Correct 42 ms 3676 KB Output is correct
14 Incorrect 50 ms 4688 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 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 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 67 ms 348 KB Output is correct
15 Correct 30 ms 348 KB Output is correct
16 Correct 44 ms 348 KB Output is correct
17 Correct 58 ms 348 KB Output is correct
18 Correct 53 ms 344 KB Output is correct
19 Correct 68 ms 416 KB Output is correct
20 Correct 53 ms 344 KB Output is correct
21 Correct 39 ms 344 KB Output is correct
22 Correct 46 ms 344 KB Output is correct
23 Correct 36 ms 344 KB Output is correct
24 Correct 42 ms 592 KB Output is correct
25 Correct 43 ms 412 KB Output is correct
26 Runtime error 4 ms 604 KB Execution killed with signal 7
27 Halted 0 ms 0 KB -