Gabi88's blog

By Gabi88, history, 16 months ago, In English

Hello! Can you help me with this task (I came up with it myself).

Task: You get an NxN matrix consisting of zeros and ones. You also have an operation where you can 3x3 submatrix turn into zeros. Your task is to convert all ones to zeros with as few operations as possible.

The size of N is unknown, but I was aiming for N <= 2000.

Input: You get integer N and matrix of size NxN. It can only have zeros and ones.

Output: Print integer, the minimal number of operations.

Example:
5

00100
11111
00100
00100
00000

Answer: 2

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

»
15 months ago, # |
  Vote: I like it +3 Vote: I do not like it

Auto comment: topic has been updated by Gabi88 (previous revision, new revision, compare).

»
15 months ago, # |
  Vote: I like it +3 Vote: I do not like it

Auto comment: topic has been updated by Gabi88 (previous revision, new revision, compare).

»
15 months ago, # |
  Vote: I like it +1 Vote: I do not like it

It's probably a NP problem, but I'm not sure. It can easily be solved with DP in O(2^n).

»
15 months ago, # |
  Vote: I like it +3 Vote: I do not like it

Auto comment: topic has been updated by Gabi88 (previous revision, new revision, compare).