bhayanak's blog

By bhayanak, history, 7 years ago, In English

i want an help beecause it is a difficult questions (sorry for mine poor english)

https://www.codechef.com/problems/DIGJUMP

  • Vote: I like it
  • +2
  • Vote: I do not like it

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

You can make graph with edges between i and i + 1. Also when you visit some verix u with digit x, and you haven't visited any other vertix with the same digit, you can push all of them into the queue, setting the distance to them dst[u] + 1.

Code