#include "treasure.h"
int Check[101][101];
void Quad_Search(int ly, int lx, int ry, int rx)
{
int midy=(ly+ry)/2, midx=(lx+rx)/2;
if(ly==ry && lx==rx)
Check[ly][lx]=1;
else
{
if(ly<=midy && lx<=midx)
{
if(countTreasure(ly,lx,midy,midx))
Quad_Search(ly,lx,midy,midx);
}
if(ly<=midy && midx+1<=rx)
{
if(countTreasure(ly,midx+1,midy,rx))
Quad_Search(ly,midx+1,midy,rx);
}
if(midy+1<=ry && lx<=midx)
{
if(countTreasure(midy+1,lx,ry,midx))
Quad_Search(midy+1,lx,ry,midx);
}
if(midy+1<=ry && midx+1<=rx)
if(countTreasure(midy+1,midx+1,ry,rx))
Quad_Search(midy+1,midx+1,ry,rx);
}
}
void findTreasure(int N)
{
int i, j;
Quad_Search(1,1,N,N);
for(i=1 ; i<=N ; i++)
for(j=1 ; j<=N ; j++)
if(Check[i][j])
Report(i,j);
}
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 |
Incorrect |
0 ms |
1224 KB |
Output isn't correct - N = 5, K = 820, score = 0 |
2 |
Incorrect |
0 ms |
1224 KB |
Output isn't correct - N = 10, K = 13184, score = 0 |
3 |
Incorrect |
0 ms |
1224 KB |
Output is partially correct - N = 15, K = 44442, score = 1 |
4 |
Incorrect |
0 ms |
1224 KB |
Output is partially correct - N = 16, K = 51576, score = 1 |
5 |
Incorrect |
0 ms |
1224 KB |
Output isn't correct - N = 55, K = 11892639, score = 0 |
6 |
Incorrect |
0 ms |
1224 KB |
Output isn't correct - N = 66, K = 24590726, score = 0 |
7 |
Incorrect |
0 ms |
1224 KB |
Output is partially correct - N = 77, K = 30127948, score = 1 |
8 |
Incorrect |
0 ms |
1224 KB |
Output is partially correct - N = 88, K = 59622130, score = 1 |
9 |
Incorrect |
0 ms |
1224 KB |
Output isn't correct - N = 99, K = 128280963, score = 0 |
10 |
Incorrect |
0 ms |
1224 KB |
Output isn't correct - N = 100, K = 133585475, score = 0 |