Submission #961385

# Submission time Handle Problem Language Result Execution time Memory
961385 2024-04-12T03:01:34 Z ByeWorld Secret (JOI14_secret) C++14
Compilation error
0 ms 0 KB
#include "secret.h"
#include <bits/stdc++.h>
#include <random>
#define ll long long
#define int long long
#define fi first
#define se second
#define pb push_back
#define md ((l+r)>>1)
#define lf (id<<1)
#define rg ((id<<1)|1)
#define ld long double
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,pii> ipii;
const int MAXN = 1e3+10;
const int MAXA = 1e6+10;
const int INF = 2e18+10;
const int LOG = 30;
const int MOD = 1e9+7;

int n;
int a[MAXN], dep[MAXN];
map <pii, int> m;

void bd(int DEP, int l, int r){
	if(l>r) return;
	// cout << DEP << ' ' << l << ' ' << r << " pp\n";
	int mid = md;
	dep[mid] = DEP;
	if(l==r) return;

	int val = a[mid];
	for(int i=mid-1; i>=l; i--){
		val = Secret(a[i], val); // ke kiri
		m[pii(i, mid)] = val;
	}
	val = a[mid+1];
	for(int i=mid+2; i<=r; i++){
		val = Secret(val, a[i]); // ke kanan
		m[pii(mid+1, i)] = val;
	}
	bd(DEP+1, l, mid-1); bd(DEP+1, mid+1, r);
}

void Init(int N, int x[]) {
	n = N;
	for(int i=0; i<n; i++){
		a[i+1] = x[i]; m[pii(i+1, i+1)] = x[i];
	}
	bd(1, 1, n);
	// for(int i=1; i<=n; i++) cout << dep[i] << " \n"[i==n];
}

int Query(int L, int R) {
	L++; R++;
	int idx = -1, mn = INF;
	for(int i=L; i<=R; i++){
		if(mn > dep[i]){
			idx = i;
			mn = dep[i];
		}
	}
	return Secret(m[pii(L, idx)], m[pii(idx+1, R)]);
}

Compilation message

/usr/bin/ld: /tmp/cclHCl5R.o: in function `main':
grader-full.cpp:(.text.startup+0x2a8): undefined reference to `Init(int, int*)'
/usr/bin/ld: grader-full.cpp:(.text.startup+0x30b): undefined reference to `Query(int, int)'
collect2: error: ld returned 1 exit status