HOMIARA_RUBY's blog

By HOMIARA_RUBY, history, 7 years ago, In English

http://ideone.com/0MRF6u

how to solve this problem? I want to solve it but couldn't find any approach? no tutorial or source code is available. I spent enough time for it.

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

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

Use bitmasks

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

    Dear, is it anyhow possible using dp? (without bitmasks)

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

      This is not possible without bitmask as you can not select the candies from the same cell twice(once while selecting its row and once while selection its column). So, you need to keep a track of which rows and columns you have already selected to prevent adding the same cell twice.