676 - Horse Step Maze
Moderator: Board moderators
676 - Horse Step Maze
Seems like a simple enough problem, but I notice low acceptance rates on it. My program dies with:
Your program has died with signal 25 (SIGXFSZ). Meaning:
File size limit exceeded
which makes no sense since it doesnr use files and the problem does not have a special judge or anything. So two questions:
1. Any special considerations for this question ?
2. Anyone seen sigxfsz before ?
Your program has died with signal 25 (SIGXFSZ). Meaning:
File size limit exceeded
which makes no sense since it doesnr use files and the problem does not have a special judge or anything. So two questions:
1. Any special considerations for this question ?
2. Anyone seen sigxfsz before ?
-
- Experienced poster
- Posts: 167
- Joined: Fri Oct 19, 2001 2:00 am
- Location: Saint Petersburg, Russia
Re: 676 Horse Step Maze
Yes, I've got this error two times when solving (actually speeding up) P495. But I have no idea what it means. I've asked one man from OJ team about this SIGXFSZ but he's also wasn't able to say what this error means!Caesum wrote:2. Anyone seen sigxfsz before ?

-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
-
- Experienced poster
- Posts: 151
- Joined: Wed Aug 21, 2002 12:07 am
- Location: Seoul, Korea
- Contact:
Is there any
Are there any "fail" cases? I've tried it for every starting & ending position combinations and couldn't find one..
Isn't it "fail" when the mouse attempts to backtrack from its original position?
The output specification in the problem statement mentions:

Help! I've been getting too much WAs. :'(
Thanks in advance.
Isn't it "fail" when the mouse attempts to backtrack from its original position?
The output specification in the problem statement mentions:
It confuses meThe coordinates of the walking path from the starting point to the ending point or ``fail''.

Help! I've been getting too much WAs. :'(
Thanks in advance.
-
- Experienced poster
- Posts: 151
- Joined: Wed Aug 21, 2002 12:07 am
- Location: Seoul, Korea
- Contact:
Oh, thanks, but..
Now I got that 'failed' cases can be found when analyzing beyond the 50000th step. But, removing the break-up routine when the 50000th step is reached, gives out TLE.
What shall I do? :'(
Is there a trick in the input, or it's just my program's matter?
How can I detect 'failed' cases easily?
Now I got that 'failed' cases can be found when analyzing beyond the 50000th step. But, removing the break-up routine when the 50000th step is reached, gives out TLE.
What shall I do? :'(
Is there a trick in the input, or it's just my program's matter?
How can I detect 'failed' cases easily?
-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
I got OLE... help
Hi, can you give me some input/output test please, i have a mistake, here is my code, if you see something wrong please tell me.
Code: Select all
/*
Horse Step Maze, UVa # 676
Nephtali Garrido
27/06/06
*/
#include <cstdio>
#include <iostream>
using namespace std;
int n,c,c2;
bool mat[9][9],ya;
char xi,yi,xf,yf,x;
void busca(int x, int y)
{ if(x!=xi || y!=yi)
printf(", (%d,%d)",x+1,y+1);
if(x==xf && y==yf)
{ ya=true;
return;
}
mat[x][y]=true;
if(x>0 && y<8 && mat[x-1][y+1]==false)
{ busca(x-1,y+1);
if(ya==true)
return;
printf(", (%d,%d)",x+1,y+1);
}
if(x<8 && y<8 && mat[x+1][y+1]==false)
{ busca(x+1,y+1);
if(ya==true)
return;
printf(", (%d,%d)",x+1,y+1);
}
if(x<8 && y>0 && mat[x+1][y-1]==false)
{ busca(x+1,y-1);
if(ya==true)
return;
printf(", (%d,%d)",x+1,y+1);
}
if(x>0 && y>0 && mat[x-1][y-1]==false)
{ busca(x-1,y-1);
if(ya==true)
return;
printf(", (%d,%d)",x+1,y+1);
}
mat[x][y]=false;
return;
}
int main()
{ scanf("%d",&n);
while(n>0)
{ n--;
cin>>x>>xi>>x>>yi>>x>>x>>xf>>x>>yf>>x;
xi-=('0'+1);yi-=('0'+1);xf-=('0'+1);yf-=('0'+1);
if((xi+yi)%2==(xf+yf)%2)
{ for(c=0;c<9;c++)
for(c2=0;c2<9;c2++)
mat[c][c2]=false;
if(xi!=xf || yi!=yf)
{ ya=false;
printf("(%d,%d)",xi+1,yi+1);
busca(xi,yi);
}
else
printf("(%d,%d)",xi+1,yi+1);
}
else
printf("fail");
printf("\n");
}
return 0;
}
Re: I got OLE... help
You did not handle the 50000+ step case at all.Fali wrote:Hi, can you give me some input/output test please, i have a mistake, here is my code, if you see something wrong please tell me.
-
- Experienced poster
- Posts: 154
- Joined: Sat Apr 17, 2004 9:34 am
- Location: EEE, BUET