Блог пользователя HOMIARA_RUBY

Автор HOMIARA_RUBY, история, 7 лет назад, По-английски

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.

  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится

»
7 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Use bitmasks

  • »
    »
    7 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

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

    • »
      »
      »
      7 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      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.