Submission #548159

# Submission time Handle Problem Language Result Execution time Memory
548159 2022-04-12T15:26:43 Z Alex_tz307 Secret (JOI14_secret) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "secret.h"

using namespace std;

const int kN = 1e3;
const int kLog = 16;
int n, a[kN], dp[kN][kLog];

int Secret(int x, int y) {
  return 0;
}

void solve(int l, int r, int level) {
  if (l == r) {
    return;
  }
  int mid = (l + r) / 2;
  dp[mid][level] = a[mid];
  dp[mid + 1][level] = a[mid + 1];
  for (int i = mid - 1; i >= l; --i) {
    dp[i][level] = Secret(dp[i + 1][level], a[i]);
  }
  for (int i = mid + 2; i <= r; ++i) {
    dp[i][level] = Secret(dp[i - 1][level], a[i]);
  }
  solve(l, mid, level + 1);
  solve(mid + 1, r, level + 1);
}

void Init(int N, int A[]) {
  n = N;
  for (int i = 0; i < n; ++i) {
    a[i] = A[i];
  }
  solve(0, n - 1, 0);
}

int Query(int l, int r) {
  if (l == r) {
    return a[l];
  }
  int st = 0, dr = n - 1, level = 0;
  while (st <= dr) {
    int mid = (st + dr) / 2;
    if (l <= mid && mid < r) {
      return Secret(dp[l][level], dp[r][level]);
    }
    if (mid < l) {
      st = mid + 1;
    } else {
      dr = mid;
    }
    level += 1;
  }
}

Compilation message

secret.cpp: In function 'int Query(int, int)':
secret.cpp:56:1: warning: control reaches end of non-void function [-Wreturn-type]
   56 | }
      | ^
/usr/bin/ld: /tmp/ccCNExzA.o: in function `Secret(int, int)':
secret.cpp:(.text+0x0): multiple definition of `Secret(int, int)'; /tmp/ccd3ElID.o:grader-full.cpp:(.text+0x2d0): first defined here
collect2: error: ld returned 1 exit status