### Al-Khwarizmi_Fan's blog

By Al-Khwarizmi_Fan, 2 years ago,

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)}))$

• +42

By Al-Khwarizmi_Fan, 2 years ago,

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

• -19

By Al-Khwarizmi_Fan, history, 3 years ago,
• Which website/application do you think is the best among those :
1. Codeforces