이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define ordered_multiset tree<type1, null_type, less_equal<type1>, rb_tree_tag, tree_order_statistics_node_update>;
 
using namespace std;
using namespace __gnu_pbds;
 
const int mod = 998244353;
const double PI = acos(-1.0);
const double epsilon = 1e-6;
const int N = 1.5e5+5;
int n;
vector<int> a(N),b(N),c(N);
int mp[6][6][6];
void solve3(){
	int ans = -1;
	
	for(int i = 0; i < n; i++){
		mp[a[i]][b[i]][c[i]]++;
	}
	
	for(int x = 1; x <= 5; x++){
		for(int y = 1; y <= 5; y++){
			for(int z = 1; z <= 5; z++){
				for(int x1 = 1; x1 <= 5; x1++){
					for(int y1 = 1; y1 <= 5; y1++){
						for(int z1 = 1; z1 <= 5; z1++){
							for(int x2 = 1; x2 <= 5; x2++){
								for(int y2 = 1; y2 <= 5; y2++){
									for(int z2 = 1; z2 <= 5; z2++){
										if((x == x1 && y == y1 && z == z1) || (x2 == x1 && y2 == y1 && z2 == z1) || (x == x2 && y == y2 && z == z2)) continue;
										if(!(x > x1 && x > x2 && y1 > y && y1 > y2 && z2 > z && z2 > z1)) continue;
										
										if(mp[x][y][z] && mp[x1][y1][z1] && mp[x2][y2][z2]){
											ans = max(ans, x + y1 + z2);
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	cout << ans;
}
void solve(){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i] >> b[i] >> c[i];
	}
	
	if(n > 300){
		solve3();
		return;
	}
	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) continue;
				if(a[i] > a[j] && a[i] > a[k] && 
				   b[j] > b[i] && b[j] > b[k] && 
				   c[k] > c[j] && c[k] > c[i] 
				   ) ans = max(ans, a[i] + b[j] + c[k]);
			}
		}
	}
	cout << ans;
}
 
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
 
    int tt = 1;
    //cin >> tt;
    while (tt--) {
        solve();
    }
}
컴파일 시 표준 에러 (stderr) 메시지
team.cpp:84:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   84 | main(){
      | ^~~~| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |