Submission #255877

# Submission time Handle Problem Language Result Execution time Memory
255877 2020-08-02T03:26:09 Z IOrtroiii Secret (JOI14_secret) C++14
Compilation error
0 ms 0 KB
#include "secret.h"

#include <bits/stdc++.h>

using namespace std;

int dp[1010][1010];

void gen(int l, int r, int A[]) {
   if (l == r) {
      dp[l][r] = A[l];
      return;
   }
   int md = (l + r) >> 1;
   gen(l, md, A);
   gen(md + 1, r, A);
   for (int i = md - 1; i >= l; --i) dp[i][md] = Secret(A[i], dp[i + 1][md]);
   for (int i = md + 2; i <= r; ++i) dp[i][md] = Secret(dp[md + 1][i - 1], A[i]);
}

void Init(int N, int A[]) {
   memset(dp, -1, sizeof dp);
   gen(0, N - 1);
}

int Query(int l, int r) {
   if (l == r) return A[l];
   for (int md = l; md < r; ++md) {
      if (dp[l][md] >= 0 && dp[md + 1][r] >= 0) {
         return Secret(dp[l][md], dp[md + 1][r]);
      }
   }
}

Compilation message

secret.cpp: In function 'void Init(int, int*)':
secret.cpp:23:16: error: too few arguments to function 'void gen(int, int, int*)'
    gen(0, N - 1);
                ^
secret.cpp:9:6: note: declared here
 void gen(int l, int r, int A[]) {
      ^~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:27:23: error: 'A' was not declared in this scope
    if (l == r) return A[l];
                       ^