結果
問題 |
No.1141 田グリッド
|
ユーザー |
![]() |
提出日時 | 2020-08-02 06:43:23 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 608 bytes |
コンパイル時間 | 201 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 22,656 KB |
最終ジャッジ日時 | 2024-07-18 02:17:29 |
合計ジャッジ時間 | 20,404 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 10 |
ソースコード
mod = 10**9 + 7 h, w = map(int, input().split()) a = [list(map(int, input().split())) for i in range(h)] product_all = 1 product_row = [1] * h product_column = [1] * w for i in range(h): for j in range(w): product_all *= a[i][j] product_all %= mod product_row[i] *= a[i][j] product_row[i] %= mod product_column[j] *= a[i][j] product_column[j] %= mod q = int(input()) for i in range(q): r, c = map(int, input().split()) print(product_all * pow(product_row[r - 1], mod - 2, mod) * pow(product_column[c - 1], mod - 2, mod) * a[r - 1][c - 1] % mod)