Submission #125930

# Submission time Handle Problem Language Result Execution time Memory
125930 2019-07-06T14:25:00 Z AlexLuchianov Secret (JOI14_secret) C++14
Compilation error
0 ms 0 KB
#include <secret.h>

int const nmax = 1000;

//int Secret(int X, int Y)

int dp[1 + nmax][1 + nmax];

void compute(int from, int to){
  int mid = (from + to) / 2;
  compute(from, mid);
  compute(mid + 1, to);
  for(int i = mid - 1; from <= i; i--){
    if(dp[i][mid] == -1)
      dp[i][mid] = Secret(A[i], dp[i + 1][mid]);
  }
  for(int i = mid + 2; i <= to; i++)
    if(dp[mid + 1][i] == -1)
      dp[mid + 1][i] = Secret(dp[mid + 1][i - 1], A[i]);
}
int n;

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

int ask(int from, int to, int x, int y){
  int mid = (from + to)/ / 2;
  if(x <= mid && mid + 1 <= y)
    return Secret(dp[x][mid], dp[mid + 1][y]);
  else {
    if(y <= mid)
      return ask(from, mid, x, y);
    else
      return ask(mid + 1, to, x, y);
  }
}

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

Compilation message

secret.cpp: In function 'void compute(int, int)':
secret.cpp:15:27: error: 'A' was not declared in this scope
       dp[i][mid] = Secret(A[i], dp[i + 1][mid]);
                           ^
secret.cpp:19:51: error: 'A' was not declared in this scope
       dp[mid + 1][i] = Secret(dp[mid + 1][i - 1], A[i]);
                                                   ^
secret.cpp: In function 'int ask(int, int, int, int)':
secret.cpp:34:26: error: expected primary-expression before '/' token
   int mid = (from + to)/ / 2;
                          ^