Submission #880242

# Submission time Handle Problem Language Result Execution time Memory
880242 2023-11-29T04:09:46 Z Regulus Team Contest (JOI22_team) C++17
9 / 100
126 ms 8932 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 = 2e5+5;
const int Mxm = 10;
ll x[N], y[N], z[N], c[N], cc[Mxm][Mxm][Mxm];
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=-1, m=0;

    cin >> n;
    for (i=1; i <= n; ++i)
    {
        cin >> x[i] >> y[i] >> z[i];
        cc[x[i]][y[i]][z[i]] = 1;
    }

    for (i=1; i <= 5; ++i)
    {
        for (j=1; j <= 5; ++j)
        {
            for (k=1; k <= 5; ++k)
            {
                if (cc[i][j][k])
                {
                    ++m;
                    x[m] = i, y[m] = j, z[m] = k;
                }
            }
        }
    }
    
    for (i=1; i <= m; ++i)
    {
        for (j=1; j <= m; ++j)
        {
            if (i == j) continue;
            for (k=1; k <= m; ++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 4440 KB Output is correct
2 Correct 1 ms 4440 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Runtime error 4 ms 8932 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4440 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Runtime error 4 ms 8932 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4440 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 126 ms 5720 KB Output is correct
12 Correct 21 ms 5724 KB Output is correct
13 Correct 25 ms 6200 KB Output is correct
14 Correct 23 ms 6568 KB Output is correct
15 Correct 17 ms 6492 KB Output is correct
16 Correct 17 ms 6492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4440 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 126 ms 5720 KB Output is correct
12 Correct 21 ms 5724 KB Output is correct
13 Correct 25 ms 6200 KB Output is correct
14 Correct 23 ms 6568 KB Output is correct
15 Correct 17 ms 6492 KB Output is correct
16 Correct 17 ms 6492 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Incorrect 15 ms 4640 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4440 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 126 ms 5720 KB Output is correct
12 Correct 21 ms 5724 KB Output is correct
13 Correct 25 ms 6200 KB Output is correct
14 Correct 23 ms 6568 KB Output is correct
15 Correct 17 ms 6492 KB Output is correct
16 Correct 17 ms 6492 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Incorrect 15 ms 4640 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4440 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 126 ms 5720 KB Output is correct
12 Correct 21 ms 5724 KB Output is correct
13 Correct 25 ms 6200 KB Output is correct
14 Correct 23 ms 6568 KB Output is correct
15 Correct 17 ms 6492 KB Output is correct
16 Correct 17 ms 6492 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Incorrect 15 ms 4640 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4440 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Runtime error 4 ms 8932 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -