Submission #111508

# Submission time Handle Problem Language Result Execution time Memory
111508 2019-05-15T13:42:55 Z vex Secret (JOI14_secret) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include <secret.h>
#define maxn 1005
#define pii pair<int,int>
using namespace std;

int len;
vector<pii>v;
int rez[maxn][maxn];

void napravi(int l,int r,int a[])
{
	int duz=r-l+1;
	if(duz<=1)return;
	
	int mid=(l+r)/2;
	v.push_back({l,r});
	
	rez[mid][mid+1]=a[mid+1];
	rez[mid][mid]=a[mid];
	for(int i=mid+2;i<=r;i++)rez[mid][i]=Secret(rez[mid][i-1],a[i]);
	for(int i=mid-1;i>=l;i--)rez[i][mid]=Secret(a[i],rez[i+1][mid]);
	
	napravi(l,mid-1);
	napravi(mid+1,r);
}
void Init(int n,int a[])
{
	len=n;
	napravi(0,n-1,a[]);
}
int Query(int l,int r)
{
	for(auto x:v)
	{
		int ll=x.first;
		int rr=x.second;
		int mid=(ll+rr)/2;
		
		if(ll<=l && l<=mid && mid<=r && r<=rr)
		{
			if(r==mid)return rez[l][mid];
			return Secret(rez[l][mid],rez[mid][r]);
		}
	}
}

Compilation message

secret.cpp: In function 'void napravi(int, int, int*)':
secret.cpp:24:17: error: too few arguments to function 'void napravi(int, int, int*)'
  napravi(l,mid-1);
                 ^
secret.cpp:11:6: note: declared here
 void napravi(int l,int r,int a[])
      ^~~~~~~
secret.cpp:25:17: error: too few arguments to function 'void napravi(int, int, int*)'
  napravi(mid+1,r);
                 ^
secret.cpp:11:6: note: declared here
 void napravi(int l,int r,int a[])
      ^~~~~~~
secret.cpp: In function 'void Init(int, int*)':
secret.cpp:30:18: error: expected primary-expression before ']' token
  napravi(0,n-1,a[]);
                  ^
secret.cpp: In function 'int Query(int, int)':
secret.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^