Submission #1139005

#TimeUsernameProblemLanguageResultExecution timeMemory
1139005luanzitoSecret (JOI14_secret)C++20
Compilation error
0 ms0 KiB
#include "secret.h"

const int maxl = 10;
const int maxn = 1e4;

int n;
int v[maxn], st[maxl][maxn];

void build(int n2, int v2[]) {
	n = n2;
	for (int i = 0; i < n; i++) v[i] = v2[i];
	while (n&(n-1)) n++;
	for (int j = 0; (1<<j) < n; j++) {
		int len = 1<<j;
		for (int c = len; c < n; c += 2*len) {
			m[j][c] = v[c], m[j][c-1] = v[c-1];
			for (int i = c+1; i <  c+len; i++) m[j][i] = Secret(m[j][i-1], v[i]);
			for (int i = c-2; i >= c-len; i--) m[j][i] = Secret(v[i], m[j][i+1]);
		}
	}
}

void init(int N, int A[]){
    n = N;
    build(n, A);
}

int query(int L, int R){
    if (L == R) return v[L];
	int j = __builtin_clz(1) - __builtin_clz(L^R);
	return op(m[j][L], m[j][R]);
}

Compilation message (stderr)

secret.cpp: In function 'void build(int, int*)':
secret.cpp:16:25: error: 'm' was not declared in this scope
   16 |                         m[j][c] = v[c], m[j][c-1] = v[c-1];
      |                         ^
secret.cpp: In function 'int query(int, int)':
secret.cpp:31:19: error: 'm' was not declared in this scope
   31 |         return op(m[j][L], m[j][R]);
      |                   ^
secret.cpp:31:16: error: 'op' was not declared in this scope
   31 |         return op(m[j][L], m[j][R]);
      |                ^~