Submission #386805

# Submission time Handle Problem Language Result Execution time Memory
386805 2021-04-07T10:54:48 Z saarang123 Secret (JOI14_secret) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
const int mxn = 1002;
int a[mxn][mxn], n;

int Secret(int x, int y) { return x ^ y; }
void fix(int l, int r) {
	int mid = (l + r) >> 1;
	if(r - l <= 1)
		return;
	for(int i = mid + 1; i <= r; i++)
		a[mid][i] = Secret(a[mid][i - 1], a[i][i]);
	for(int i = mid - 1; i >= l; i--)
		a[i][mid] = Secret(a[i][i], a[i + 1][mid]);
	fix(l, mid);
	fix(mid + 1, r);
}

void Init(int N, int A[]) {
	n = N;
	for(int i = 0; i < n; i++) 
		for(int j = 0; j < n; j++)
			a[i][j] = (i == j ? A[i] : -1);
	fix(0, n - 1);
}

int answer(int l, int r, int ql, int qr) {
	int mid = (l + r) >> 1;
	if(ql > mid)
		return answer(mid + 1, r, ql, qr);
	else if(qr < mid)
		return answer(l, mid, ql, qr);
	return Secret(a[ql][mid], a[mid + 1][qr]);
}

int Query(int L, int R) {
	return answer(0, n - 1, L, R);
}

Compilation message

/tmp/ccftKs0U.o: In function `Secret(int, int)':
secret.cpp:(.text+0x0): multiple definition of `Secret(int, int)'
/tmp/cce2k3bR.o:grader-full.cpp:(.text+0x2d0): first defined here
collect2: error: ld returned 1 exit status