Submission #1100465

# Submission time Handle Problem Language Result Execution time Memory
1100465 2024-10-14T03:26:50 Z anhphant Secret (JOI14_secret) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
typedef long long  ll;

int N, A[1000007], Q;
ll dat[17][1007], mask[1007];

// int Secret(int a, int b) {
// 	return a + b;
// }

void divi(ll l, ll r, ll lev, int A[]) {
	if (l == r) return;
	ll mid = (l + r) / 2;
	dat[lev][mid] = A[mid];
	for(int i = mid - 1; i >= l; --i) {
		dat[lev][i] = Secret(A[i], dat[lev][i + 1]);
	}
	dat[lev][mid + 1] = A[mid + 1];
	for(int i = mid + 2; i <= r; ++i) {
		dat[lev][i] = Secret(dat[lev][i - 1], A[i]);
	}
	for(int i = mid + 1; i <= r; ++i) mask[i] ^= (1 << lev);
	divi(l, mid, lev + 1);
	divi(mid + 1, r, lev + 1);
}

void Init(int N, int A[]) {
	cin >> N;
	for(int i = 1; i <= N; ++i) cin >> A[i];

	divi(1, N, 0, A[]);
}

int Query(int l, int r) {
	l++;
	r++;
	if (l == r) return A[l];
	int bits = __builtin_ctz(mask[l] ^ mask[r]);
	return Secret(dat[bits][l], dat[bits][r]);
}

Compilation message

secret.cpp: In function 'void divi(ll, ll, ll, int*)':
secret.cpp:25:22: error: too few arguments to function 'void divi(ll, ll, ll, int*)'
   25 |  divi(l, mid, lev + 1);
      |                      ^
secret.cpp:13:6: note: declared here
   13 | void divi(ll l, ll r, ll lev, int A[]) {
      |      ^~~~
secret.cpp:26:26: error: too few arguments to function 'void divi(ll, ll, ll, int*)'
   26 |  divi(mid + 1, r, lev + 1);
      |                          ^
secret.cpp:13:6: note: declared here
   13 | void divi(ll l, ll r, ll lev, int A[]) {
      |      ^~~~
secret.cpp: In function 'void Init(int, int*)':
secret.cpp:33:18: error: expected primary-expression before ']' token
   33 |  divi(1, N, 0, A[]);
      |                  ^