제출 #965633

#제출 시각아이디문제언어결과실행 시간메모리
965633gaga999Garden (JOI23_garden)C++17
컴파일 에러
0 ms0 KiB
// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx,avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#define lowbit(x) ((x) & -(x))
#define ml(a, b) ((1ll * (a) * (b)) % M)
#define tml(a, b) (a) = ((1ll * (a) * (b)) % M)
#define ad(a, b) ((0ll + (a) + (b)) % M)
#define tad(a, b) (a) = ((0ll + (a) + (b)) % M)
#define mi(a, b) ((0ll + M + (a) - (b)) % M)
#define tmi(a, b) (a) = ((0ll + M + (a) - (b)) % M)
#define tmin(a, b) (a) = min((a), (b))
#define tmax(a, b) (a) = max((a), (b))
#define iter(a) (a).begin(), (a).end()
#define riter(a) (a).rbegin(), (a).rend()
#define init(a, b) memset((a), (b), sizeof(a))
#define cpy(a, b) memcpy((a), (b), sizeof(a))
#define uni(a) a.resize(unique(iter(a)) - a.begin())
#define size(x) (int)x.size()
#define pb emplace_back
#define mpr make_pair
#define ls(i) ((i) << 1)
#define rs(i) ((i) << 1 | 1)
#define INF 0x3f3f3f3f
#define NIF 0xc0c0c0c0
#define eps 1e-9
#define F first
#define S second
#define AC cin.tie(0)->sync_with_stdio(0)
using namespace std;
typedef long long llt;
typedef __int128_t lll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<llt, llt> pll;
typedef complex<double> cd;
// const int M = 998244353;
 
// random_device rm;
// mt19937 rg(rm());
// default_random_engine rg(rm());
// uniform_int_distribution<int> rd(INT_MIN, INT_MAX);
// uniform_real_distribution<double> rd(0, M_PI);
 
void db() { cerr << "\n"; }
template <class T, class... U>
void db(T a, U... b) { cerr << a << " ", db(b...); }
 
inline char gc()
{
    const static int SZ = 1 << 16;
    static char buf[SZ], *p1, *p2;
    if (p1 == p2 && (p2 = buf + fread(p1 = buf, 1, SZ, stdin), p1 == p2))
        return -1;
    return *p1++;
}
void rd() {}
template <typename T, typename... U>
void rd(T &x, U &...y)
{
   cin>>x,rd(y...);
}
 
template <typename T>
void prt(T x)
{
    cout<<x;
}
 
const int N = 5005;
typedef int[N] bs;
bs b1, b2, vd[N];
int dp[N][N], top[N], tp2;
 
signed main()
{
    int n, m, k, x, y, mx = 0;
    rd(n, m, k);
    for (int i = 1; i <= n; i++)
        rd(x, y), b1[x] = 1, b2[y] = 1, tmax(tp2, x);
    for (int i = 1; i <= m; i++)
        rd(x, y), vd[x][y] = 1, tmax(top[y], x);
    if (!b1[0])
        for (int j = 0; j < k; j++)
            if (!b2[j] && !vd[0][j])
                dp[0][j] = k - max(top[j], tp2);
    for (int i = 1; i < k; i++)
    {
        if (b1[i])
            continue;
        for (int j = 0; j < k; j++)
        {
            if (b2[j] || vd[i][j])
                continue;
            dp[i][j] = min(k, dp[i - 1][j] + 1);
        }
    }
    auto cg = [&](int a, int b) -> void
    {
        if (a > 0 && b > 0)
        {
            tmin(a, k - 1), tmin(b, k - 1);
            tmax(mx, k * (a + b) - a * b);
        }
    };
    for (int i = 0; i < k; i++)
    {
        if (b1[i])
            continue;
        vector<pii> sk(1, pii(-1, -1));
        for (int j = 0; j < k << 1; j++)
        {
            int cv = dp[i][j >= k ? j - k : j];
            while (cv <= sk.back().F)
            {
                int tp = sk.back().F;
                sk.pop_back();
                cg(tp, j - sk.back().S - 1);
            }
            sk.pb(cv, j);
        }
        for (pii j : sk)
            cg(j.F, (k << 1) - j.S);
    }
    for (int i = 0, ct; i < k; i++)
    {
        ct = 0;
        while (ct < k - 1 && !b1[(i + ct) % k])
            ct++;
        tmax(mx, k * ct);
        ct = 0;
        while (ct < k - 1 && !b2[(i + ct) % k])
            ct++;
        tmax(mx, k * ct);
    }
    prt(k * k - mx), putchar('\n');
}

컴파일 시 표준 에러 (stderr) 메시지

garden.cpp:71:1: error: structured binding declaration cannot be 'typedef'
   71 | typedef int[N] bs;
      | ^~~~~~~
garden.cpp:71:12: error: structured binding declaration cannot have type 'int'
   71 | typedef int[N] bs;
      |            ^~~
garden.cpp:71:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
garden.cpp:71:13: error: conflicting declaration 'auto N'
   71 | typedef int[N] bs;
      |             ^
garden.cpp:70:11: note: previous declaration as 'const int N'
   70 | const int N = 5005;
      |           ^
garden.cpp:71:16: error: expected initializer before 'bs'
   71 | typedef int[N] bs;
      |                ^~
garden.cpp:72:1: error: 'bs' does not name a type; did you mean 'abs'?
   72 | bs b1, b2, vd[N];
      | ^~
      | abs
garden.cpp: In function 'int main()':
garden.cpp:80:19: error: 'b1' was not declared in this scope; did you mean 'y1'?
   80 |         rd(x, y), b1[x] = 1, b2[y] = 1, tmax(tp2, x);
      |                   ^~
      |                   y1
garden.cpp:80:30: error: 'b2' was not declared in this scope
   80 |         rd(x, y), b1[x] = 1, b2[y] = 1, tmax(tp2, x);
      |                              ^~
garden.cpp:82:19: error: 'vd' was not declared in this scope; did you mean 'rd'?
   82 |         rd(x, y), vd[x][y] = 1, tmax(top[y], x);
      |                   ^~
      |                   rd
garden.cpp:83:10: error: 'b1' was not declared in this scope; did you mean 'y1'?
   83 |     if (!b1[0])
      |          ^~
      |          y1
garden.cpp:85:18: error: 'b2' was not declared in this scope
   85 |             if (!b2[j] && !vd[0][j])
      |                  ^~
garden.cpp:85:28: error: 'vd' was not declared in this scope; did you mean 'rd'?
   85 |             if (!b2[j] && !vd[0][j])
      |                            ^~
      |                            rd
garden.cpp:89:13: error: 'b1' was not declared in this scope; did you mean 'y1'?
   89 |         if (b1[i])
      |             ^~
      |             y1
garden.cpp:93:17: error: 'b2' was not declared in this scope
   93 |             if (b2[j] || vd[i][j])
      |                 ^~
garden.cpp:93:26: error: 'vd' was not declared in this scope; did you mean 'rd'?
   93 |             if (b2[j] || vd[i][j])
      |                          ^~
      |                          rd
garden.cpp:108:13: error: 'b1' was not declared in this scope; did you mean 'y1'?
  108 |         if (b1[i])
      |             ^~
      |             y1
garden.cpp:128:31: error: 'b1' was not declared in this scope; did you mean 'y1'?
  128 |         while (ct < k - 1 && !b1[(i + ct) % k])
      |                               ^~
      |                               y1
garden.cpp:132:31: error: 'b2' was not declared in this scope
  132 |         while (ct < k - 1 && !b2[(i + ct) % k])
      |                               ^~