Submission #39391

#TimeUsernameProblemLanguageResultExecution timeMemory
39391pce913Treasure (different grader from official contest) (CEOI13_treasure2)C++14
0 / 100
0 ms1820 KiB
#include "treasure.h"
#include<algorithm>
using namespace std;


int M[405][405];
int n;
const int BOUND = 128;
void find_ans(int cx,int cy,int len){
	if (len == 1){
		M[cx][cy] = countTreasure(cx, cy, cx, cy) == 1;
		return;
	}

	int sum = countTreasure(cx, cy, min(n, cx + len - 1), min(n, cy + len - 1));
	if (sum != min(len,n-cx+1)*min(len,n-cy+1)){
		find_ans(cx, cy, len / 2);
		find_ans(cx + len/2, cy, len / 2);
		find_ans(cx, cy + len / 2, len / 2);
		find_ans(cx + len / 2, cy + len / 2, len / 2);
	}
	else{
		for (int i = cx; i <= cx + len - 1; i++){
			for (int j = cy; j <= cy + len - 1; j++){
				M[i][j] = 1;
			}
		}
	}
}


void  findTreasure(int N) {
	n = N;
	//total = countTreasure(1, 1, N, N);
	find_ans(1, 1, BOUND);
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= n; j++){
			if (M[i][j] == 1)
				Report(i, j);
		}
	}
}

Compilation message (stderr)

grader.c: In function 'int main()':
grader.c:63:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         my_assert(strlen(A[i]+1) == N, "each line of the map must contain N zeroes or ones (before loop)");
                                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...