Submission #729944

# Submission time Handle Problem Language Result Execution time Memory
729944 2023-04-24T22:41:50 Z jampm Secret (JOI14_secret) C++17
0 / 100
454 ms 4412 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, 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) {
  //cout << L << " " << R << endl;
  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);
}
# Verdict Execution time Memory Grader output
1 Incorrect 114 ms 2408 KB Wrong Answer: Query(264, 271) - expected : 675707686, actual : 456275163.
2 Incorrect 118 ms 2384 KB Wrong Answer: Query(236, 238) - expected : 173116186, actual : 416517106.
3 Incorrect 119 ms 2400 KB Wrong Answer: Query(128, 153) - expected : 959658850, actual : 219466354.
4 Incorrect 454 ms 4392 KB Wrong Answer: Query(374, 396) - expected : 402362963, actual : 342036658.
5 Incorrect 434 ms 4308 KB Wrong Answer: Query(703, 706) - expected : 857111674, actual : 727225567.
6 Incorrect 436 ms 4300 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 707400362.
7 Correct 444 ms 4412 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
8 Correct 448 ms 4332 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
9 Correct 438 ms 4292 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
10 Correct 449 ms 4316 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1