Submission #966931

# Submission time Handle Problem Language Result Execution time Memory
966931 2024-04-20T16:07:09 Z Perl32 Secret (JOI14_secret) C++14
0 / 100
418 ms 4612 KB
//I wrote this code 4 u <3
#include <bits/stdc++.h>
#include "secret.h"

using namespace std;
using ll = long long;

#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif

constexpr int lg = 11;
constexpr int maxN = 1001;
int dat[lg][maxN];
int a[maxN], msk[maxN];

void divi(int l, int r, int lvl) {
    if (l == r) return;
    int m = (l + r) >> 1;
    dat[lvl][m] = a[m];
    for (int i = m; i >= l; --i) dat[lvl][i] = Secret(a[i], dat[lvl][i + 1]);
    dat[lvl][m + 1] = a[m + 1];
    for (int i = m + 2; i <= r; ++i) dat[lvl][i] = Secret(dat[lvl][i - 1], a[i]);
    for (int i = m + 1; i <= r; ++i) msk[i] ^= 1 << lvl;
    divi(l, m, lvl + 1);
    divi(m + 1, r, lvl + 1);
}

void Init(int N, int A[]) {
    for (int i = 0; i < N; ++i) a[i] = A[i];
    divi(0, N - 1, 0);
}

int Query(int l, int r) {
    if(l == r) return a[l];
    int lvl = __builtin_ctz(msk[l] ^ msk[r]);
    return Secret(dat[lvl][l], dat[lvl][r]);
}

//signed main(int32_t argc, char *argv[]) {
//    ios_base::sync_with_stdio(false);
//    cin.tie(nullptr);
//
//}

/*

 */
# Verdict Execution time Memory Grader output
1 Incorrect 102 ms 2640 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 34031537.
2 Incorrect 103 ms 2636 KB Wrong Answer: Query(102, 157) - expected : 32612619, actual : 569483529.
3 Incorrect 103 ms 2812 KB Wrong Answer: Query(67, 224) - expected : 202440844, actual : 739311628.
4 Incorrect 375 ms 4504 KB Wrong Answer: Query(727, 872) - expected : 870334875, actual : 870334619.
5 Incorrect 377 ms 4432 KB Wrong Answer: Query(761, 790) - expected : 112945480, actual : 112871752.
6 Incorrect 393 ms 4540 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 950134466.
7 Partially correct 385 ms 4428 KB Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1
8 Partially correct 418 ms 4612 KB Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1
9 Partially correct 383 ms 4344 KB Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1
10 Partially correct 385 ms 4436 KB Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1