Submission #729933

# Submission time Handle Problem Language Result Execution time Memory
729933 2023-04-24T22:20:30 Z jampm Secret (JOI14_secret) C++17
0 / 100
462 ms 4508 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) 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(ST[depth][i + 1], A[i]);
  }
  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 118 ms 2380 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 537147980.
2 Incorrect 117 ms 2484 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 480981001.
3 Incorrect 120 ms 2380 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 431042602.
4 Incorrect 455 ms 4300 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 806453253.
5 Incorrect 430 ms 4508 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 675973468.
6 Incorrect 456 ms 4392 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 156045047.
7 Incorrect 462 ms 4368 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 261226608.
8 Incorrect 431 ms 4504 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 477538568.
9 Incorrect 452 ms 4400 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 22557571.
10 Incorrect 445 ms 4460 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 805996614.