Submission #337276

# Submission time Handle Problem Language Result Execution time Memory
337276 2020-12-19T08:03:01 Z nandonathaniel Secret (JOI14_secret) C++14
Compilation error
0 ms 0 KB
#include "bits/stdc++.h"
#include "secret.h"
using namespace std;
const int MAXN=1005;

int N,A[MAXN],hasil[MAXN][MAXN],x,y;

void build(int L,int R){
	if(L==R){
		hasil[L][L]=A[L];
		return;
	}
	int mid=(L+R)/2;
	hasil[mid][mid]=A[mid];
	for(int i=mid-1;i>=L;i--)hasil[i][mid]=Secret(A[i],hasil[i+1][mid]);
	hasil[mid+1][mid+1]=A[mid+1];
	for(int i=mid+2;i<=R;i++)hasil[mid+1][i]=Secret(hasil[mid+1][i-1],A[i]);
	build(L,mid);
	build(mid+1,R);
}

int tanya(int L,int R){
	if(L==R)return hasil[L][L];
	int mid=(L+R)/2;
	if(y<=mid)return tanya(L,mid);
	if(x>=mid+1)return tanya(mid+1,R);
	return Secret(hasil[x][mid],hasil[mid+1][y]);
}

void Init(int n, vector<int> a) {
	N=n;
	for(int i=0;i<N;i++)A[i+1]=a[i];
	build(1,N);
}

int Query(int l, int r) {
	x=l;
	y=r;
	x++;y++;
    return tanya(1,N);
}

Compilation message

/tmp/cc0eP6OI.o: In function `main':
grader-full.cpp:(.text.startup+0x298): undefined reference to `Init(int, int*)'
collect2: error: ld returned 1 exit status