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

×

July Cook Off CHEFIHG question

I have a doubt regarding this question. It was mentioned that we can choose any non prohibited cell as the starting point. To reach C any of the U,D,L,R should be non prohibited. So, if I just start from any non prohibited cell that lies either U,or D,or L, or R of 'C' and then just take it to C using single instruction, why am I getting WA? Pardon me if I understood the question wrong.

asked 25 Jul '16, 21:07

ksut28's gravatar image

3★ksut28
313
accept rate: 0%


Well you are considering some cells one by one and taking each of them to cell 'C' while doing this one by one , the other cells might get displaced from the original positions.

link

answered 25 Jul '16, 21:22

geek_geek's gravatar image

4★geek_geek
43914
accept rate: 16%

No, I am just checking the cells around C. If any of them are not prohibited, then I am printing the corresponding instruction.

Example 5 6

++++++

+.C..+

++.+++

+....+

++++++

In this cell 2 2 is not prohibited. So, I choose my starting city as 2 2 and then just move 'R'.

where + represents *

link

answered 25 Jul '16, 23:22

ksut28's gravatar image

3★ksut28
313
accept rate: 0%

edited 25 Jul '16, 23:39

C should be reached in traversing path you give by ans from every'.' eg 5 6

++++++

+.C..+

++.+++

+....+

++++++ you can reach C by going right 'R' from 1,1 L from 1,3

LL from 1,4

U from 2,2

and so on

lets assume your ans is UDLRUDLR then for every '.' check if traversing along this path ,you travel to 'C' atleast once

link

answered 26 Jul '16, 00:17

the_mad_king's gravatar image

5★the_mad_king
1
accept rate: 0%

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,351

question asked: 25 Jul '16, 21:07

question was seen: 539 times

last updated: 26 Jul '16, 00:17