Submission #111476

# Submission time Handle Problem Language Result Execution time Memory
111476 2019-05-15T12:51:31 Z vex Secret (JOI14_secret) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include <secret.h>
#define maxn 1005
using namespace std;

int rez[12][maxn];
int to[maxn];
int tpp[maxn];

void Init(int n,int a[])
{
	for(int i=1;i<=n;i*=2)
	{
		int pos=n-i;
		rez[i][0]=a[i];
		for(int j=1;pos+j<n;j++)
		{
			rez[i][j]=secret(rez[i][j-1],a[pos+j]);
		}
		
		to[pos-1]=a[pos-1];
		tpp[pos-1]=i;
		for(int j=pos-2;j>max(pos-2*i,-1);j--)
		{
			to[j]=secret(a[j],to[j+1]);
			tpp[j]=i;
		}
	}
}

int Query(int l,int r)
{
	if(__builtin_popcount(n-l)==1)
	{
		int x=log2(r-l+1);
		if((1<<x)!=r-l+1)x++;
		
		return rez[x][r-x];
	}
	else
	{
		return secret(to[l],rez[tpp[l]][r-(n-(1<<tpp[l]))])
	}
}

Compilation message

secret.cpp: In function 'void Init(int, int*)':
secret.cpp:18:14: error: 'secret' was not declared in this scope
    rez[i][j]=secret(rez[i][j-1],a[pos+j]);
              ^~~~~~
secret.cpp:18:14: note: suggested alternative: 'Secret'
    rez[i][j]=secret(rez[i][j-1],a[pos+j]);
              ^~~~~~
              Secret
secret.cpp:25:10: error: 'secret' was not declared in this scope
    to[j]=secret(a[j],to[j+1]);
          ^~~~~~
secret.cpp:25:10: note: suggested alternative: 'Secret'
    to[j]=secret(a[j],to[j+1]);
          ^~~~~~
          Secret
secret.cpp: In function 'int Query(int, int)':
secret.cpp:33:24: error: 'n' was not declared in this scope
  if(__builtin_popcount(n-l)==1)
                        ^
secret.cpp:42:10: error: 'secret' was not declared in this scope
   return secret(to[l],rez[tpp[l]][r-(n-(1<<tpp[l]))])
          ^~~~~~
secret.cpp:42:10: note: suggested alternative: 'Secret'
   return secret(to[l],rez[tpp[l]][r-(n-(1<<tpp[l]))])
          ^~~~~~
          Secret
secret.cpp:43:2: error: expected ';' before '}' token
  }
  ^