Submission #1244194

#TimeUsernameProblemLanguageResultExecution timeMemory
1244194nvujicaTeam Contest (JOI22_team)C++20
9 / 100
25 ms584 KiB
#include <bits/stdc++.h>

#define ll long long
#define fi first
#define se second

using namespace std;

const int maxn = 1.5e5 + 10;

int n;
//int x[maxn];
//int y[maxn];
//int z[maxn];
map <vector <int>, int> mp;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	cin >> n;
	
	for(int i = 0; i < n; i++){
		int x, y, z;
		cin >> x >> y >> z;
		mp[{x, y, z}] = 1;
	}
	
	int ans = 0;
	
	for(int xa = 1; xa <= 5; xa++){
		for(int yb = 1; yb <= 5; yb++){
			for(int zc = 1; zc <= 5; zc++){
				for(int xc = 1; xc < xa; xc++){
					for(int ya = 1; ya < yb; ya++){
						for(int zb = 1; zb < zc; zb++){
							for(int xb = 1; xb < xa; xb++){
								for(int yc = 1; yc < yb; yc++){
									for(int za = 1; za < zc; za++){
										if(mp[{xa, ya, za}] && mp[{xb, yb, zb}] && mp[{xc, yc, zc}]) ans = max(ans, xa + yb + zc);
									}
								}
							}
						}
					}
				}
			}
		}
	}
	
	if(ans == 0) ans--;
	cout << ans;

	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...