Submission #984373

# Submission time Handle Problem Language Result Execution time Memory
984373 2024-05-16T15:09:45 Z LOLOLO Secret (JOI14_secret) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
#define           f     first
#define           s     second
#define           pb    push_back
#define           ep    emplace
#define           eb    emplace_back
#define           lb    lower_bound
#define           ub    upper_bound
#define       all(x)    x.begin(), x.end()
#define      rall(x)    x.rbegin(), x.rend()
#define   uniquev(v)    sort(all(v)), (v).resize(unique(all(v)) - (v).begin())
#define     mem(f,x)    memset(f , x , sizeof(f))
#define        sz(x)    (int)(x).size()
#define  __lcm(a, b)    (1ll * ((a) / __gcd((a), (b))) * (b))
#define          mxx    *max_element
#define          mnn    *min_element
#define    cntbit(x)    __builtin_popcountll(x)
#define       len(x)    (int)(x.length())
 
const int N = 1e3 + 10;
int n;
int a[N], f[N][N];

void prepare(int l, int r) {
    if (l > r) {
        return;
    }

    int m = (l + r) / 2;
    int val = a[m];
    f[m][m] = val;
    f[m + 1][m + 1] = a[m + 1];

    for (int j = m + 2; j <= r; j++) {
        f[m + 1][j] = Secret(f[m + 1][j - 1], a[j]);
    }

    for (int j = m - 1; j >= l; j--) {
        f[j][m] = Secret(f[j + 1][m], a[j]);
    }

    prepare(l, m - 1);
    prepare(m + 1, r);
}

void Init(int _n, int _a[]) {
    n = _n;
    for (int i = 1; i <= n; i++)
        a[i] = _a[i - 1];

    mem(f, -1);
    prepare(1, n);
}

int get(int l, int r, int u, int v) {
    int m = (l + r) / 2;
    if (m >= u && m <= v) {
        if (m == v) {
            return f[u][m];
        }
        return Secret(f[u][m], f[m + 1][v]);
    }

    if (m > v) {
        return get(l, m - 1, u, v);
    }

    return get(m + 1, r, u, v);
}

int query(int l, int r) {
    l++, r++;
    if (l == r) {
        return a[l];
    }

    return get(1, n, l, r);
}

Compilation message

secret.cpp: In function 'void prepare(int, int)':
secret.cpp:38:23: error: 'Secret' was not declared in this scope
   38 |         f[m + 1][j] = Secret(f[m + 1][j - 1], a[j]);
      |                       ^~~~~~
secret.cpp:42:19: error: 'Secret' was not declared in this scope
   42 |         f[j][m] = Secret(f[j + 1][m], a[j]);
      |                   ^~~~~~
secret.cpp: In function 'int get(int, int, int, int)':
secret.cpp:64:16: error: 'Secret' was not declared in this scope
   64 |         return Secret(f[u][m], f[m + 1][v]);
      |                ^~~~~~