QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100

#3738. 家を建てる

Statistics

Bobo は ICPCCamp で $n \times m$ の土地を購入しました。そのうち一部のマスには障害物があります。

彼は 2 つの長方形の領域を選び、2 軒の家を建てたいと考えています。 当然、家を建てる領域には障害物が含まれていてはいけません。また、2 つの領域は重なってはいけません(隣接していてもかまいません)。

Bobo は、考えられるすべての異なる方法の個数を $(10^9 + 7)$ で割った余りを知りたいと考えています。

入力

入力には $10$ 個以下のテストケースが含まれます。

各テストケースの最初の行には、2 つの整数 $n, m$ ($1 \leq n, m \leq 10^3$) が含まれます。

続く $n$ 行のうち $i$ 行目には、長さ $m$ の文字列 $s_i$ が含まれます。$s_i$ の $j$ 番目の文字が 0 なら $i$ 行 $j$ 列のマスは空き地であり、1 ならそのマスには障害物があります。

出力

各テストケースについて、求める値を表す整数を出力してください。

入出力例

入力 1

2 2
00
01
3 4
1000
0001
0100

出力 1

5
160

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.