Submission #86156

#TimeUsernameProblemLanguageResultExecution timeMemory
86156facelessTreasure (different grader from official contest) (CEOI13_treasure2)C++14
Compilation error
0 ms0 KiB
#include "treasure.h"

int find2 (int r1, int c1, int r2, int c2, int cnt = -1) {
	if (cnt == -1)
		cnt = countTreasure (r1, c1, r2 - 1, c2 - 1);
	if (cnt == 0)
		return cnt;
	if (cnt == (r2 - r1) * (c2 - c1)) {
		for (int j = c1; j <= c2; j++)
			c[r1][j] = 1;
		return cnt;
	}
	int mid = (c1 + c2) >> 1;
	int x = find2 (r1, c1, r2, mid);
	find2 (r1, mid, r2, c2, x);
	return cnt;
}

int find (int r1, int c1, int r2, int c2, int cnt = -1) {
	if (cnt == -1)
		cnt = countTreasure (r1, c1, r2 - 1, c2 - 1);
	if (cnt == 0)
		return cnt;
	if (cnt == (r2 - r1) * (c2 - c1)) {
		for (int i = r1; i <= r2; i++)
			for (int j = c1; j <= c2; j++)
				c[i][j] = 1;
		return cnt;
	}
	if (r1 + 1 == r2) {
		find2 (r1, c1, r2, c2);
		return cnt;
	}
	int mid = (r1 + r2) >> 1;
	int x = find (r1, c1, mid, c2);
	find (mid, c1, r2, c2, cnt - x);
	return cnt;
}

void findTreasure (int N) {
	find (1, 1, N + 1, N + 1);	
	for (int i = 1; i <= N; i++)
		for (int j = 1; j <= N; j++)
			if (c[i][j])
				Report (i, j);
}

Compilation message (stderr)

treasure.cpp: In function 'int find2(int, int, int, int, int)':
treasure.cpp:10:4: error: 'c' was not declared in this scope
    c[r1][j] = 1;
    ^
treasure.cpp: In function 'int find(int, int, int, int, int)':
treasure.cpp:27:5: error: 'c' was not declared in this scope
     c[i][j] = 1;
     ^
treasure.cpp: In function 'void findTreasure(int)':
treasure.cpp:44:8: error: 'c' was not declared in this scope
    if (c[i][j])
        ^