Submission #173162

# Submission time Handle Problem Language Result Execution time Memory
173162 2020-01-03T14:03:22 Z lee107601 Treasure (different grader from official contest) (CEOI13_treasure2) C++14
33 / 100
2 ms 504 KB
#include "treasure.h"
#include <iostream>
typedef struct nodet {
	int y;
	int x;
}node;
node q[100001] = { 0, };
int q_c = 0;
void go(int sy,int sx,int ey,int ex,int ret,int typ) {
	//printf("%d %d %d %d %d %d\n", sy, sx, ey, ex, ret, typ);
	if (sy == ey && sy == ey) {	
		q[q_c++] = { sy,sx };
		//Report(sy, sx);
		return;
	}
	if (typ == 0) {//x축으로 줄일것
		int midx = (sx + ex) / 2;
		int v = 0;
		v = countTreasure(sy, sx, ey, midx);
		if (v != 0) {
			if (sx == midx) go(sy, sx, ey, midx, v,1);
			else go(sy, sx, ey, midx, v, 0);
		}
		if (v == ret) return;
		if ((midx+1) == ex) go(sy, midx + 1, ey, ex, ret - v, 1);
		else go(sy, midx + 1, ey, ex, ret - v, 0);
	}
	else {//y축으로 줄일것
		int midy = (sy + ey) / 2;
		int v = 0;
		v = countTreasure(sy, sx, midy, ex);
		if (v != 0) {
			go(sy, sx, midy, ex, v, 1);
		}
		if (v == ret) return;
		go(midy+1, sx, ey, ex, ret - v, 1);
	}
}

void findTreasure (int N) {
    int cnt = countTreasure(1, 1, N, N);
	if (cnt != 0) go(1, 1, N, N, cnt, 0);
	for (int i = 0; i < q_c; i++) Report(q[i].y, q[i].x);
    //if(cnt > 0) Report (1, 1);
}
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 376 KB Output is partially correct - N = 5, K = 505, score = 8
2 Partially correct 2 ms 376 KB Output is partially correct - N = 10, K = 8520, score = 1
3 Partially correct 2 ms 376 KB Output is partially correct - N = 15, K = 35323, score = 4
4 Partially correct 2 ms 376 KB Output is partially correct - N = 16, K = 35174, score = 8
5 Partially correct 2 ms 376 KB Output is partially correct - N = 55, K = 7770783, score = 1
6 Partially correct 2 ms 376 KB Output is partially correct - N = 66, K = 16656476, score = 1
7 Partially correct 2 ms 376 KB Output is partially correct - N = 77, K = 20678792, score = 4
8 Partially correct 2 ms 380 KB Output is partially correct - N = 88, K = 40705530, score = 4
9 Partially correct 2 ms 504 KB Output is partially correct - N = 99, K = 83935078, score = 1
10 Partially correct 2 ms 504 KB Output is partially correct - N = 100, K = 87339185, score = 1