Submission #40599

# Submission time Handle Problem Language Result Execution time Memory
40599 2018-02-05T08:16:23 Z ljk0411jg Treasure (different grader from official contest) (CEOI13_treasure2) C++14
68 / 100
2 ms 660 KB
#include "treasure.h"
typedef struct _data
{
	int x, y;
}Data;
Data Point[10005];
int N, idx;

void input(int sx, int sy, int ex, int ey)
{
	for (int i = sy; i <= ey; i++)
	{
		for (int j = sx; j <= ex; j++)
		{
			Point[idx].x = j;
			Point[idx++].y = i;
		}
	}
}

int func(int sx, int sy, int ex, int ey, int t, int flag)
{
	int count, x, y, ret = 0;
	x = ex - sx + 1;
	y = ey - sy + 1;
	if (flag == 0)
	{
		count = countTreasure(sx, sy, ex, ey);
	}
	else
	{
		count = t;
	}
	if (x * y == count)
	{
		input(sx, sy, ex, ey);
		return count;
	}
	else if (count == 0)
	{
		return 0;
	}
	if (x > y)
	{
		int mid;
		mid = (sx + ex) / 2;
		ret = func(sx, sy, mid, ey, t, 0);
		if (ret == count)
		{
			return ret;
		}
		ret += func(mid + 1, sy, ex, ey, count - ret, 1);
	}
	else
	{
		int mid;
		mid = (sy + ey) / 2;
		ret = func(sx, sy, ex, mid, t, 0);
		if (ret == count)
		{
			return ret;
		}
		ret += func(sx, mid + 1, ex, ey, count - ret, 1);
	}
	return ret;
}

void findTreasure(int N) {
	idx = 0;
	func(1, 1, N, N, 1, 0);
	for (int i = 0; i < idx; i++)
	{
		Report(Point[i].x, Point[i].y);
	}
}

Compilation message

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 time Memory Grader output
1 Partially correct 1 ms 248 KB Output is partially correct - N = 5, K = 380, score = 8
2 Partially correct 1 ms 352 KB Output is partially correct - N = 10, K = 6426, score = 4
3 Correct 1 ms 552 KB Output is correct - N = 15, K = 16762, score = 10
4 Correct 1 ms 552 KB Output is correct - N = 16, K = 14778, score = 10
5 Partially correct 2 ms 552 KB Output is partially correct - N = 55, K = 6533585, score = 4
6 Partially correct 2 ms 612 KB Output is partially correct - N = 66, K = 13929687, score = 4
7 Correct 2 ms 660 KB Output is correct - N = 77, K = 5460074, score = 10
8 Correct 2 ms 660 KB Output is correct - N = 88, K = 7209518, score = 10
9 Partially correct 2 ms 660 KB Output is partially correct - N = 99, K = 69557120, score = 4
10 Partially correct 2 ms 660 KB Output is partially correct - N = 100, K = 72999285, score = 4