You are not logged in. Please login at www.codechef.com to post your questions!

×

How to apply BFS in such scenario?

There is one grid

...x..

@.*.X.

.*.*..

where '.' represent visible path, '*' represent check point, '@' represent starting point and 'x' represent blocked path.

Now I want to find minimum distance from source to each check point and from each check point to every other check point.

Basically I want to make a weighted complete graph that comprises of all check points and source where weight of each edge is minimum distance between that point to other point.

Refer this problem on spoj for further details.

asked 16 Aug '16, 00:15

arpit728's gravatar image

1★arpit728
6831563
accept rate: 10%


Your problem is similar to this spoj problem : http://www.spoj.com/problems/A_W_S_N/

You can find it's solution here : http://codespro.blogspot.in/2015/07/spoj-awsn-happy-valentine-day-valentine.html

link

answered 16 Aug '16, 01:16

vipsharmavip's gravatar image

6★vipsharmavip
3228
accept rate: 23%

@vipsharmavip

I have already mentioned the link to the problem.Can you please explain me the logic.

(16 Aug '16, 05:50) arpit7281★
toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×2,093
×1,197
×500
×125

question asked: 16 Aug '16, 00:15

question was seen: 1,019 times

last updated: 16 Aug '16, 05:50