Submission #99043

# Submission time Handle Problem Language Result Execution time Memory
99043 2019-02-28T07:27:52 Z wjdclgns12 Treasure (different grader from official contest) (CEOI13_treasure2) C++14
68 / 100
3 ms 384 KB
#include "treasure.h"

int cnt = 0;
int resultX[10001];
int resultY[10001];

void findFunc(int r1, int c1, int r2, int c2, int trs)
{
	int area = (r2 - r1 + 1) * (c2 - c1 + 1);
	if (trs == 0) return;
	if (trs == area)
	{
		for (int i = r1; i <= r2; i++) for (int j = c1; j <= c2; j++)
		{
			resultX[cnt] = i;
			resultY[cnt] = j;
			cnt++;
		}
		return;
	}

	if (r1 != r2)
	{
		int half = countTreasure(r1, c1, (r1 + r2) / 2, c2);
		findFunc(r1, c1, (r1 + r2) / 2, c2, half);
		findFunc((r1 + r2) / 2 + 1, c1, r2, c2, trs - half);
	}
	else
	{
		int half = countTreasure(r1, c1, r2, (c1 + c2) / 2);
		findFunc(r1, c1, r2, (c1 + c2) / 2, half);
		findFunc(r1, (c1 + c2) / 2 + 1, r2, c2, trs - half);
	}

	return;

}

void findTreasure(int N) {
	
	findFunc(1, 1, N , N, countTreasure(1, 1, N, N));

	for (int i = 0; i < cnt; i++)
	{
		Report(resultX[i], resultY[i]);
	}

}
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 384 KB Output is partially correct - N = 5, K = 481, score = 8
2 Partially correct 2 ms 384 KB Output is partially correct - N = 10, K = 6633, score = 4
3 Correct 2 ms 384 KB Output is correct - N = 15, K = 15790, score = 10
4 Correct 1 ms 384 KB Output is correct - N = 16, K = 23613, score = 10
5 Partially correct 2 ms 384 KB Output is partially correct - N = 55, K = 6654673, score = 4
6 Partially correct 2 ms 384 KB Output is partially correct - N = 66, K = 13777290, score = 4
7 Correct 2 ms 384 KB Output is correct - N = 77, K = 7743847, score = 10
8 Correct 2 ms 384 KB Output is correct - N = 88, K = 10099283, score = 10
9 Partially correct 2 ms 384 KB Output is partially correct - N = 99, K = 70743424, score = 4
10 Partially correct 3 ms 384 KB Output is partially correct - N = 100, K = 74229655, score = 4