Submission #48657

# Submission time Handle Problem Language Result Execution time Memory
48657 2018-05-17T17:51:39 Z Pajaraja Secret (JOI14_secret) C++17
Compilation error
0 ms 0 KB
#include "secret.h"
#include <bits/stdc++.h>
#define MAXN 1007
using namespace std;
int val[MAXN][MAXN],a[MAXN],n;
void rek(int l,int r)
{
	int s=(l+r)/2;
	for(int i=s-1;i>=l;i--) val[i][s]=Secret(a[i],val[i+1][s]);
	for(int i=s+2;i<=r;i++) val[s+1][i]=Secret(val[s+1][i-1],a[i]);
	if(l+1==r) return;
	rek(l,s);
	rek(s+1,r);
}
void Init(int N, int A[]) 
{
	n=N;
	for(int i=0;i<n;i++) val[i][i]=a[i]=A[i];
	rek(0,n-1);
}

int ans(int l,int r,int lt,int rt)
{
	if(l==r) return v[l][r];
	int s=(l+r)/2;
	if(lt<=s && rt>s) return Secret(val[lt][s],val[s+1][rt]);
	if(rt<=s) return ans(l,s,lt,rt);
	return ans(s+1,r,lt,rt);
}
int Query(int L, int R)  {return ans(0,n-1,L,R);}

Compilation message

secret.cpp: In function 'int ans(int, int, int, int)':
secret.cpp:24:18: error: 'v' was not declared in this scope
  if(l==r) return v[l][r];
                  ^