답안 #647079

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
647079 2022-10-01T14:32:20 Z georgievskiy popa (BOI18_popa) C++14
컴파일 오류
0 ms 0 KB
#include "popa.h";

#include <bits/stdc++.h>
using namespace std;

int rec(int l, int r, int* left, int* right) {
	if (l >= r)
		return -1;
	if (l + 1 == r)
		return l;
	int root;
	for (int i = l; i < r; i++) {
		if (query(l, r + 1, i, i)) {
			root = i;
			break;
		}
	}
	int l_c = rec(l, root, left, right);
	int r_c = rec(root + 1, r, left, right);
	left[root] = l_c, right[root] = r_c;
}

int solve(int n, int* left, int* right) {
	fill(left, left + n, -1), fill(right, right + n, -1);
	return rec(l, r, left, right);
}

Compilation message

popa.cpp:1:18: warning: extra tokens at end of #include directive
    1 | #include "popa.h";
      |                  ^
popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:25:13: error: 'l' was not declared in this scope
   25 |  return rec(l, r, left, right);
      |             ^
popa.cpp:25:16: error: 'r' was not declared in this scope
   25 |  return rec(l, r, left, right);
      |                ^
popa.cpp: In function 'int rec(int, int, int*, int*)':
popa.cpp:20:32: warning: control reaches end of non-void function [-Wreturn-type]
   20 |  left[root] = l_c, right[root] = r_c;
      |                    ~~~~~~~~~~~~^~~~~