Submission #729952

# Submission time Handle Problem Language Result Execution time Memory
729952 2023-04-24T22:49:21 Z jampm Secret (JOI14_secret) C++17
0 / 100
436 ms 4528 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;

int const Mxn = 1e3 + 1;
int const LOGN = 13;


ll ST[LOGN][Mxn];
ll A[Mxn];
int n;

void build(int L = 0, int R = n - 1, int depth = 0) {
  if (L == R) return;
  int Mid = (L + R)>>1;
  for (int i = Mid + 1; i <= R; i++) {
    ST[depth][i] = (i == Mid + 1) ? A[i] : Secret(ST[depth][i - 1], A[i]);
  }
  for (int i = Mid; i >= L; i--) {
    ST[depth][i] = (i == Mid) ? A[i] : Secret(A[i], ST[depth][i + 1]);
  }
  build(L, Mid, depth + 1), build(Mid + 1, R, depth + 1);
}
ll query(int l, int r, int L = 0, int R = n, int depth = 0) {
  if (L == R) return A[L];
  int Mid = (L + R)>>1;
  if (l <= Mid && Mid < r) return Secret(ST[depth][l], ST[depth][r]);
  if (r <= Mid) return query(l, r, L, Mid, depth + 1);
  else return query(l, r, Mid + 1, R, depth + 1);
}

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

int Query(int L, int R) {
  return query(L, R);
}
# Verdict Execution time Memory Grader output
1 Correct 130 ms 2412 KB Output is correct - number of calls to Secret by Init = 3578, maximum number of calls to Secret by Query = 1
2 Incorrect 126 ms 2412 KB Wrong Answer: Query(236, 238) - expected : 173116186, actual : 416517106.
3 Incorrect 124 ms 2348 KB Wrong Answer: Query(356, 361) - expected : 632571906, actual : 210200836.
4 Incorrect 423 ms 4424 KB Wrong Answer: Query(955, 956) - expected : 283256648, actual : 287040792.
5 Incorrect 427 ms 4248 KB Wrong Answer: Query(750, 875) - expected : 92309526, actual : 848452942.
6 Incorrect 429 ms 4356 KB Wrong Answer: Query(747, 749) - expected : 244228265, actual : 111478025.
7 Correct 434 ms 4528 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
8 Correct 435 ms 4360 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
9 Correct 436 ms 4460 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
10 Correct 431 ms 4352 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1