Submission #111474

# Submission time Handle Problem Language Result Execution time Memory
111474 2019-05-15T12:50:39 Z vex Secret (JOI14_secret) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include <secret.h>
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:5:13: error: 'maxn' was not declared in this scope
 int rez[12][maxn];
             ^~~~
secret.cpp:5:13: note: suggested alternative: 'tan'
 int rez[12][maxn];
             ^~~~
             tan
secret.cpp:6:8: error: 'maxn' was not declared in this scope
 int to[maxn];
        ^~~~
secret.cpp:6:8: note: suggested alternative: 'tan'
 int to[maxn];
        ^~~~
        tan
secret.cpp:7:9: error: 'maxn' was not declared in this scope
 int tpp[maxn];
         ^~~~
secret.cpp:7:9: note: suggested alternative: 'tan'
 int tpp[maxn];
         ^~~~
         tan
secret.cpp: In function 'void Init(int, int*)':
secret.cpp:14:3: error: 'rez' was not declared in this scope
   rez[i][0]=a[i];
   ^~~
secret.cpp:14:3: note: suggested alternative: 'drem'
   rez[i][0]=a[i];
   ^~~
   drem
secret.cpp:17:14: error: 'secret' was not declared in this scope
    rez[i][j]=secret(rez[i][j-1],a[pos+j]);
              ^~~~~~
secret.cpp:17:14: note: suggested alternative: 'Secret'
    rez[i][j]=secret(rez[i][j-1],a[pos+j]);
              ^~~~~~
              Secret
secret.cpp:20:3: error: 'to' was not declared in this scope
   to[pos-1]=a[pos-1];
   ^~
secret.cpp:20:3: note: suggested alternative: 'tm'
   to[pos-1]=a[pos-1];
   ^~
   tm
secret.cpp:21:3: error: 'tpp' was not declared in this scope
   tpp[pos-1]=i;
   ^~~
secret.cpp:24:10: error: 'secret' was not declared in this scope
    to[j]=secret(a[j],to[j+1]);
          ^~~~~~
secret.cpp:24:10: note: suggested alternative: 'Secret'
    to[j]=secret(a[j],to[j+1]);
          ^~~~~~
          Secret
secret.cpp: In function 'int Query(int, int)':
secret.cpp:32:24: error: 'n' was not declared in this scope
  if(__builtin_popcount(n-l)==1)
                        ^
secret.cpp:37:10: error: 'rez' was not declared in this scope
   return rez[x][r-x];
          ^~~
secret.cpp:37:10: note: suggested alternative: 'drem'
   return rez[x][r-x];
          ^~~
          drem
secret.cpp:41:17: error: 'to' was not declared in this scope
   return secret(to[l],rez[tpp[l]][r-(n-(1<<tpp[l]))])
                 ^~
secret.cpp:41:17: note: suggested alternative: 'tm'
   return secret(to[l],rez[tpp[l]][r-(n-(1<<tpp[l]))])
                 ^~
                 tm
secret.cpp:41:23: error: 'rez' was not declared in this scope
   return secret(to[l],rez[tpp[l]][r-(n-(1<<tpp[l]))])
                       ^~~
secret.cpp:41:23: note: suggested alternative: 'drem'
   return secret(to[l],rez[tpp[l]][r-(n-(1<<tpp[l]))])
                       ^~~
                       drem
secret.cpp:41:27: error: 'tpp' was not declared in this scope
   return secret(to[l],rez[tpp[l]][r-(n-(1<<tpp[l]))])
                           ^~~
secret.cpp:41:10: error: 'secret' was not declared in this scope
   return secret(to[l],rez[tpp[l]][r-(n-(1<<tpp[l]))])
          ^~~~~~
secret.cpp:41:10: note: suggested alternative: 'Secret'
   return secret(to[l],rez[tpp[l]][r-(n-(1<<tpp[l]))])
          ^~~~~~
          Secret
secret.cpp:42:2: error: expected ';' before '}' token
  }
  ^