Al-Khwarizmi_Fan's blog

By Al-Khwarizmi_Fan, 23 months ago, In English

You are given a chocolate bar represented as a grid of size $$$N$$$x$$$M$$$, find the number of ways you can finish the chocolate bar by eating it.

When eating the chocolate bar, each time, you remove one block from the grid which is not surrounded by another chocolate block which has not been eaten yet from all 4 directions

Example : Consider the $$$3$$$x$$$3$$$ chocolate bar below, corners colored in Dark Brown and the center in Red, every chocolate block is accessible to be eaten in the very beginning except the center, it becomes accessible if at least on the corners was eaten

What is the best complexity that can be achieved in terms of $$$N, M$$$? and how?

Edit : Sorry for not mentioning that, but the best solution I have came up with myself so far is bitmask dp in $$$O(N*M*(2^{(N*M)}))$$$

Full text and comments »

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

By Al-Khwarizmi_Fan, 2 years ago, In English


Note : I noticed this blog got Privated, why is that? I reuposted it

Full text and comments »

  • Vote: I like it
  • -19
  • Vote: I do not like it

By Al-Khwarizmi_Fan, history, 2 years ago, In English
  • Which website/application do you think is the best among those :
  1. Codeforces
  2. Facebook
  3. Instagram
  4. Twitter
  5. Youtube
  6. Telegram
  7. Discord

Full text and comments »

  • Vote: I like it
  • -45
  • Vote: I do not like it