Submission #538898

# Submission time Handle Problem Language Result Execution time Memory
538898 2022-03-18T01:42:51 Z schiftyfive4 Secret (JOI14_secret) C++14
0 / 100
466 ms 4512 KB
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;

int n;
vector<vector<int>> t(15, vector<int>(1000));

void calc(int L, int R, int dep, int A[]) {
  if (L == R) {
    t[dep][L] = A[L];
    return;
  }
  int m = (L + R) / 2;
  t[dep][m] = A[m];
  for (int i = m - 1; i >= L; i--) {
    t[dep][i] = Secret(A[i], t[dep][i + 1]);
  }
  t[dep][m + 1] = A[m + 1];
  for (int i = m + 2; i <= R; i++) {
    t[dep][i] = Secret(A[i], t[dep][i - 1]);
  }
  calc(L, m, dep + 1, A);
  calc(m + 1, R, dep + 1, A);
}

void Init(int N, int A[]) {
  n = N;
  calc(0, n - 1, 0, A);
}

int get(int L, int R, int qL, int qR, int dep) {
  if (L == R) {
    return t[dep][L];
  }
  int m = (L + R) / 2;
  if (qL <= m && m + 1 <= qR) {
    return Secret(t[dep][qL], t[dep][qR]);
  } else if (qR <= m) {
    return get(L, m, qL, qR, dep + 1);
  }
  return get(m + 1, R, qL, qR, dep + 1);
}

int Query(int L, int R) {
  return get(0, n - 1, L, R, 0);
}

// int main() {
//   ios::sync_with_stdio(false);
//   cin.tie(nullptr);
  
// }
# Verdict Execution time Memory Grader output
1 Incorrect 112 ms 2400 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 809782271.
2 Incorrect 112 ms 2424 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Incorrect 119 ms 2428 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136349820.
4 Incorrect 438 ms 4428 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 650789536.
5 Incorrect 460 ms 4428 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838.
6 Incorrect 422 ms 4352 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 61461050.
7 Incorrect 457 ms 4512 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570.
8 Incorrect 439 ms 4324 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264.
9 Incorrect 439 ms 4408 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135.
10 Incorrect 466 ms 4428 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726.