結果

問題 No.1141 田グリッド
ユーザー trineutrontrineutron
提出日時 2020-08-02 06:43:23
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 608 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 10,864 KB
実行使用メモリ 20,008 KB
最終ジャッジ日時 2023-09-25 02:17:58
合計ジャッジ時間 20,479 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,796 KB
testcase_01 AC 15 ms
7,824 KB
testcase_02 AC 16 ms
7,880 KB
testcase_03 AC 16 ms
7,944 KB
testcase_04 AC 15 ms
7,828 KB
testcase_05 AC 16 ms
7,788 KB
testcase_06 AC 15 ms
7,784 KB
testcase_07 AC 16 ms
7,856 KB
testcase_08 AC 24 ms
8,276 KB
testcase_09 AC 21 ms
8,196 KB
testcase_10 AC 25 ms
8,280 KB
testcase_11 AC 27 ms
8,436 KB
testcase_12 AC 26 ms
8,332 KB
testcase_13 AC 801 ms
16,440 KB
testcase_14 AC 931 ms
20,008 KB
testcase_15 AC 778 ms
12,328 KB
testcase_16 AC 776 ms
12,180 KB
testcase_17 AC 792 ms
12,236 KB
testcase_18 AC 724 ms
12,232 KB
testcase_19 AC 716 ms
12,200 KB
testcase_20 AC 726 ms
12,264 KB
testcase_21 AC 774 ms
12,048 KB
testcase_22 AC 776 ms
12,220 KB
testcase_23 AC 787 ms
12,176 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0