Submission #729936

# Submission time Handle Problem Language Result Execution time Memory
729936 2023-04-24T22:25:20 Z jampm Secret (JOI14_secret) C++17
0 / 100
424 ms 4384 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;

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


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

void build(int L = 0, int R = n, int depth = 0) {
  if (L + 1 == R) {
    ST[depth][L] = A[L]; return;
  }
  int Mid = (L + R)>>1;
  for (int i = Mid; i < R; i++) {
    ST[depth][i] = (i == Mid) ? A[i] : Secret(ST[depth][i - 1], A[i]);
  }
  for (int i = Mid - 1; i >= L; i--) {
    ST[depth][i] = (i == Mid - 1) ? A[i] : Secret(A[i], ST[depth][i + 1]);
  }
  build(L, Mid, depth + 1), build(Mid, R, depth + 1);
}
int query(int l, int r, int L = 0, int R = n, int depth = 0) {
  if (L + 1 == 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, 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 + 1);
}
# Verdict Execution time Memory Grader output
1 Incorrect 111 ms 2304 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 587620239.
2 Incorrect 112 ms 2400 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 510310400.
3 Incorrect 112 ms 2416 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 890761252.
4 Incorrect 421 ms 4384 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 35193360.
5 Incorrect 420 ms 4360 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 356040724.
6 Incorrect 417 ms 4308 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 156045047.
7 Incorrect 422 ms 4344 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 587402283.
8 Incorrect 423 ms 4260 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 141724744.
9 Incorrect 424 ms 4220 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 961417792.
10 Incorrect 424 ms 4324 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 609370382.