Submission #1263926

#TimeUsernameProblemLanguageResultExecution timeMemory
1263926tminhSecret (JOI14_secret)C++20
Compilation error
0 ms0 KiB
#include "bits/stdc++.h"
using namespace std;

#define task ""
#define ll long long
#define endl '\n'
#define fi first
#define se second
#define vall(a) (a).begin(), (a).end()
#define sze(a) (int)a.size()
#define pii pair<int, int>
#define pll pair<ll, ll>


#define ep emplace_back
#define pb push_back
#define pf push_front


const ll mod = 1e9 + 7;
const int N = 1005 + 5;
const ll oo = 1e18;

bool START;

ll cur[N][10], a[N], n, bit[N];
void dnc(int l, int r, int depth) {
	if (l == r) return;
	int mid = (l + r) >> 1;
	cur[mid][depth] = a[mid];
	for (int i = mid - 1; i >= l; --i) cur[i][depth] = Secret(cur[i + 1][depth], a[i]);
	
	cur[mid + 1][depth] = a[mid + 1];
	for (int i = mid + 2; i <= r; ++i) cur[i][depth] = Secret(cur[i - 1][depth], a[i]); 
	for (int i = mid + 1; i <= r; ++i) bit[i] |= (1 << depth);
	
	dnc(l, mid + 1, depth + 1);
	dnc(mid + 1, r, depth + 1);
}
void Init(int N, int A[]) {
	n = N;
	for (int i = 1; i <= n; ++i) a[i] = A[i - 1];
	dnc(1, n, 0);
}

ll Query(int L, int R) {
	++L; ++R;
	int depth = __builtin_ctz(bit[L] ^ bit[R]);
	ll ans = Secret(cur[L][depth], cur[R][depth]); 
	return ans;
}

Compilation message (stderr)

secret.cpp: In function 'void dnc(int, int, int)':
secret.cpp:31:60: error: 'Secret' was not declared in this scope
   31 |         for (int i = mid - 1; i >= l; --i) cur[i][depth] = Secret(cur[i + 1][depth], a[i]);
      |                                                            ^~~~~~
secret.cpp:34:60: error: 'Secret' was not declared in this scope
   34 |         for (int i = mid + 2; i <= r; ++i) cur[i][depth] = Secret(cur[i - 1][depth], a[i]);
      |                                                            ^~~~~~
secret.cpp: In function 'long long int Query(int, int)':
secret.cpp:49:18: error: 'Secret' was not declared in this scope
   49 |         ll ans = Secret(cur[L][depth], cur[R][depth]);
      |                  ^~~~~~