Submission #984387

# Submission time Handle Problem Language Result Execution time Memory
984387 2024-05-16T15:15:12 Z LOLOLO Secret (JOI14_secret) C++17
0 / 100
406 ms 8460 KB
#include <bits/stdc++.h>
#include "secret.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) {
        f[l][r] = a[l];
        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);
    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) {
        return Secret(f[u][m], f[m + 1][v]);
    }

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

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

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

    return get(1, n, l, r);
}
# Verdict Execution time Memory Grader output
1 Incorrect 107 ms 8280 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 0.
2 Incorrect 104 ms 8280 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 0.
3 Incorrect 105 ms 8280 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 0.
4 Incorrect 406 ms 8276 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 0.
5 Incorrect 385 ms 8280 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 0.
6 Incorrect 382 ms 8460 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 0.
7 Incorrect 384 ms 8280 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 0.
8 Incorrect 378 ms 8284 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 0.
9 Incorrect 379 ms 8280 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 0.
10 Incorrect 379 ms 8284 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 0.