Submission #713811

#TimeUsernameProblemLanguageResultExecution timeMemory
713811becaidoTeam Contest (JOI22_team)C++17
8 / 100
2068 ms2892 KiB
#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
using namespace std;

#ifdef WAIMAI
#define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE)
void dout() {cout << '\n';}
template<typename T, typename...U>
void dout(T t, U...u) {cout << t << (sizeof... (u) ? ", " : ""), dout (u...);}
#else
#define debug(...) 7122
#endif

#define ll long long
#define Waimai ios::sync_with_stdio(false), cin.tie(0)
#define FOR(x,a,b) for (int x = a, I = b; x <= I; x++)
#define pb emplace_back
#define F first
#define S second

// want O(C + n(log))

const int SIZE = 1.5e5 + 5;

int n, ans;
array<int, 3> a[SIZE];

void solve() {
    cin >> n;
    FOR (i, 1, n) FOR (j, 0, 2) cin >> a[i][j];
    sort(a + 1, a + n + 1);

    ans = -1;
    FOR (i, 1, n) FOR (j, 1, n) if (j != i) FOR (k, 1, n) if (k != i && k != j) {
        if (a[i][0] <= max(a[j][0], a[k][0])) continue;
        if (a[j][1] <= max(a[i][1], a[k][1])) continue;
        if (a[k][2] <= max(a[i][2], a[j][2])) continue;
        ans = max(ans, a[i][0] + a[j][1] + a[k][2]);
    }
    cout << ans << '\n';
}

int main() {
    Waimai;
    solve();
}
#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...