Submission #729935

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

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


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(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 112 ms 2444 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 537147980.
2 Incorrect 117 ms 2368 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 480981001.
3 Incorrect 112 ms 2376 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 431042602.
4 Incorrect 425 ms 4424 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 806453253.
5 Incorrect 416 ms 4260 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 675973468.
6 Incorrect 421 ms 4340 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 156045047.
7 Incorrect 421 ms 4300 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 261226608.
8 Incorrect 425 ms 4260 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 477538568.
9 Incorrect 419 ms 4444 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 22557571.
10 Incorrect 417 ms 4320 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 805996614.