Submission #380836

# Submission time Handle Problem Language Result Execution time Memory
380836 2021-03-23T08:58:05 Z VodkaInTheJar popa (BOI18_popa) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "popa.h"

using namespace std;

int find_root(int l, int r)
{
	for (int i = l; i <= r; i++)
	if (query(i, i, l, r))
	return i;
}

int f(int l, int r, int *left, int *right)
{
	if (l > r)
	return -1; 
	
	int root = find_root(l, r);
	left[root] = f(l, root-1);
	right[root] = f(root+1, r);
	
	return root;
}

int solve(int n, int *left, int *right)
{
	return f(0, n-1, left, right);
}

Compilation message

popa.cpp: In function 'int f(int, int, int*, int*)':
popa.cpp:19:26: error: too few arguments to function 'int f(int, int, int*, int*)'
   19 |  left[root] = f(l, root-1);
      |                          ^
popa.cpp:13:5: note: declared here
   13 | int f(int l, int r, int *left, int *right)
      |     ^
popa.cpp:20:27: error: too few arguments to function 'int f(int, int, int*, int*)'
   20 |  right[root] = f(root+1, r);
      |                           ^
popa.cpp:13:5: note: declared here
   13 | int f(int l, int r, int *left, int *right)
      |     ^
popa.cpp: In function 'int find_root(int, int)':
popa.cpp:11:1: warning: control reaches end of non-void function [-Wreturn-type]
   11 | }
      | ^