Submission #880311

# Submission time Handle Problem Language Result Execution time Memory
880311 2023-11-29T06:58:06 Z Regulus Team Contest (JOI22_team) C++17
0 / 100
1 ms 348 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 MxC = 25;
bool cc[MxC][MxC][MxC], cc2[MxC][MxC];
struct Point {
    ll x, y, z;
    Point() {}
    Point(ll xx, ll yy, ll zz) : x(xx), y(yy), z(zz) {}
} p[N];
vector<Point> v[MxC];

inline bool cmp_x(Point a, Point b) { return a.x < b.x; }


int main(void)
{ IO
    ll n, i, j, tmp, ans=-1, k;

    cin >> n;
    for (i=1; i <= n; ++i)
        cin >> p[i].x >> p[i].y >> p[i].z, cc[p[i].x][p[i].y][p[i].z] = 1;
    n = 0;
    for (i=1; i < MxC; ++i)
    {
        for (j=1; j < MxC; ++j)
        {
            for (k=1; k < MxC; ++k)
            {
                if (cc[i][j][k])
                {
                    ++n;
                    p[n] = {i, j, k}, v[i].pb(p[n]);
                }
            }
        }
    }
    
    sort(p+1, p+n+1, cmp_x);
    for (i=1; i <= 20; ++i)
    {
        for (auto cur : v[i])
        {
            for (j=cur.y+1; j < MxC; ++j)
                for (k=cur.z+1; k < MxC; ++k) if (cc2[j][k]) ans = max(ans, i+j+k);
        }

        for (auto cur : v[i])
        {
            for (j=1; j <= n; ++j)
            {
                if (p[j].x > i) break;
                if (p[j].y != cur.y && p[j].z != cur.z)
                    cc2[max(p[j].y, cur.y)][max(p[j].z, cur.z)] = 1;
            }
        }
    }

    for (i=1; i < MxC; ++i)
        for (j=1; j < MxC; ++j) if (cc2[i][j]) debug(i), debug(j), endl;
    
    cout << ans << '\n';

    return 0;
}

Compilation message

team.cpp: In function 'int main()':
team.cpp:30:17: warning: unused variable 'tmp' [-Wunused-variable]
   30 |     ll n, i, j, tmp, ans=-1, k;
      |                 ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -