11376 - Tilt!
Moderator: Board moderators
Yes, I have sent them a new set of input/output, but I suppose they haven't had this task rejudged yet?
When I get home I will see if I have sent them a correct i/o set. By the way, can any of you send me your should-be-correct codes, so that I can use them to check if input file is indeed correct or not? Thanks.
[EDIT] I look at the copy of the files I sent (from my mailbox). They look correct to me. Of course "look" is a fairly weak word... :- )
When I get home I will see if I have sent them a correct i/o set. By the way, can any of you send me your should-be-correct codes, so that I can use them to check if input file is indeed correct or not? Thanks.
[EDIT] I look at the copy of the files I sent (from my mailbox). They look correct to me. Of course "look" is a fairly weak word... :- )
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
I have received mf's code. I check it with the i/o set I sent to the admins and it gives correct answers! ![:-?](./images/smilies/icon_confused.gif)
![:-?](./images/smilies/icon_confused.gif)
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
I think they finally got around to fixing it cause I got accepted now
. I however don't understand why my implementation of a priority queue for A* got WA. I assume it's because it returns a non lexigraphic solution. Shouldn't the priority queue be sorted by depth+heruistic, and if that is equal to another node shouldn't it be sorted by the order of when the node was pushed on the queue? I had to make it a regular queue to get it accepted, the only reason why it runs very fast is because the program knows if a square can't find all remaining goals so it doesn't add that square to be checked, other than that it is just BFS.
![:)](./images/smilies/icon_smile.gif)
-
- A great helper
- Posts: 383
- Joined: Mon Oct 18, 2004 8:25 am
- Location: Bangladesh
- Contact:
The few places I ran into RE with this problem was reading the goal cordinates in the wrong order. I also missed the fact that goal cordinates can have 2 digits. The last place I had trouble with RE was related to reading the cordinates wrong, and happened when the program would check a square that doesn't exist in the grid.
-
- A great helper
- Posts: 383
- Joined: Mon Oct 18, 2004 8:25 am
- Location: Bangladesh
- Contact:
I have taken inputs this way..
Is there any wrong..?
Is there any wrong..?
Code: Select all
#define mabs(x) ((x)<0?(-(x)):(x))
#define mmin(a,b) ((a)>(b)?(b):(a))
#define mmax(a,b) ((a)<(b)?(b):(a))
#define idig(x) ((x)>='0' && (x)<='9')
#define Fo(i,l,h) for((i)=l;(i)<=h;++(i))
#define fo(i,n) for((i)=0;(i)<n;++(i))
char g[20][20];
int grid[20][20];
int mark[20][20];
int blue, n, nblue;
int main (void){
int i, j, k, m, a, b, x, y;
char buff[100];
//freopen("input.txt","r",stdin);
gets(buff);
n=atoi(buff);
while(1){
if(n==0)break;
fo(i,n)gets(g[i]);
fo(i,n)fo(j,n)if(idig(g[i][j]))grid[i][j]=g[i][j]-'0';
else grid[i][j]=g[i][j]-'A'+10;
fo(i,n)fo(j,n)mark[i][j]=-1;
gets(buff);
sscanf(buff,"%d%d",&x,&y);x--;y--;
blue=0;
k=0;
while(gets(buff)){
if(sscanf(buff,"%d%d",&a,&b)==2){
blue++;
a--;b--;
mark[a][b]=k++;
//printf("%d %d\n",a,b);
}
else break;
}
m=a;
nblue=k;
////////////////////////// internal logic here........................
n=m;//printf("%d\n",n);
}
return 0;
}
-
- A great helper
- Posts: 383
- Joined: Mon Oct 18, 2004 8:25 am
- Location: Bangladesh
- Contact:
-
- A great helper
- Posts: 383
- Joined: Mon Oct 18, 2004 8:25 am
- Location: Bangladesh
- Contact: