|
Its the 500 problem of SRM 198 DIV I.The name of the problem is "Dungeon Escape".
I am using dijkstra to solve this problem ..but my program has failed system testing.I think my Comparator is not designed properly..
for each movement , i have stored the position (Level and room) and time of the person and comaprator goes like this ..
class room implements Comparable { public int time; public int x,y; public room(int x1,int y1,int a) { x=x1; y=y1; time=a; } public int compareTo(Object o) { room right = (room)o; if (time < right.time) return -1; if (time >=right.time) return 1; return 0; } }
What exactly should i do in the comparator when time is same ..
plz suggest something... |