Submission #880232

# Submission time Handle Problem Language Result Execution time Memory
880232 2023-11-29T03:55:52 Z Regulus Team Contest (JOI22_team) C++17
0 / 100
1 ms 2396 KB
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(false);cin.tie(0);
#define debug(x) cerr << #x << " = " << (x) << ' '
#define endl cerr << '\n'
#define all(v) (v).begin(), (v).end()
#define SZ(v) (ll)(v).size()
#define lowbit(x) (x)&-(x)
#define pb emplace_back
#define F first
#define S second
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
 
const int N = 1e5+5;
ll x[N], y[N], z[N], c[N];
vector<int> v;

inline bool cmp_x(int a, int b) { return x[a] > x[b]; }
inline bool cmp_y(int a, int b) { return y[a] > y[b]; }
inline bool cmp_z(int a, int b) { return z[a] > z[b]; }
 
int main(void)
{ IO
    ll n, i, j, k, tmp, mx=0;

    cin >> n;
    for (i=1; i <= n; ++i) cin >> x[i] >> y[i] >> z[i];
    
    for (i=1; i <= n; ++i)
    {
        for (j=1; j <= n; ++j)
        {
            if (i == j) continue;
            for (k=1; k <= n; ++k)
            {
                if (i == k || j == k) continue;
                v.clear();
                v.pb(i), v.pb(j), v.pb(k), c[i] = c[j] = c[k] = 0;
                tmp = 0;

                sort(all(v), cmp_x);
                c[v[0]] = (x[v[0]] != x[v[1]]), tmp += x[v[0]];
                sort(all(v), cmp_y);
                c[v[0]] = (y[v[0]] != y[v[1]]), tmp += y[v[0]];
                sort(all(v), cmp_z);
                c[v[0]] = (z[v[0]] != z[v[1]]), tmp += z[v[0]];

                if (c[i] + c[j] + c[k] == 3) mx = max(mx, tmp);
            }
        }
    }

    cout << mx << '\n';

 
    return 0;
}

/*
5
3 1 4
2 3 1
1 5 5
4 4 2
5 2 3

*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Incorrect 1 ms 2396 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Incorrect 1 ms 2396 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Incorrect 1 ms 2396 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Incorrect 1 ms 2396 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Incorrect 1 ms 2396 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Incorrect 1 ms 2396 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Incorrect 1 ms 2396 KB Output isn't correct
4 Halted 0 ms 0 KB -