Submission #880312

#TimeUsernameProblemLanguageResultExecution timeMemory
880312RegulusTeam Contest (JOI22_team)C++17
18 / 100
86 ms6108 KiB
#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])
        {
            //debug(cur.x), debug(cur.y), debug(cur.z), endl;
            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)
                    || (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 (stderr)

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 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...