# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
40583 | ljk0411jg | Treasure (different grader from official contest) (CEOI13_treasure2) | C++14 | 2 ms | 676 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "treasure.h"
typedef struct _data
{
int x, y;
}Data;
Data Point[10005];
int N, zone[105][105], 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 count, x, y, ret = 0;
count = countTreasure(sx, sy, ex, ey);
x = ex - sx + 1;
y = ey - sy + 1;
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);
if (ret == count)
{
return ret;
}
ret += func(mid + 1, sy, ex, ey);
}
else
{
int mid;
mid = (sy + ey) / 2;
ret = func(sx, sy, ex, mid);
if (ret == count)
{
return ret;
}
ret += func(sx, mid + 1, ex, ey);
}
return ret;
}
void findTreasure(int N) {
for (int i = 1; i <= N; i++)
{
for (int j = 1; j <= N; j++)
{
zone[i][j] = 0;
}
}
idx = 0;
func(1, 1, N, N);
for (int i = 0; i < idx; i++)
{
Report(Point[i].y, Point[i].x);
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |