結果

問題 No.1141 田グリッド
ユーザー AEnAEn
提出日時 2022-05-21 16:42:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 562 bytes
コンパイル時間 417 ms
コンパイル使用メモリ 81,836 KB
実行使用メモリ 88,216 KB
最終ジャッジ日時 2023-10-20 16:22:04
合計ジャッジ時間 9,283 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
53,556 KB
testcase_01 AC 32 ms
53,556 KB
testcase_02 AC 32 ms
53,556 KB
testcase_03 AC 33 ms
53,556 KB
testcase_04 AC 33 ms
53,556 KB
testcase_05 AC 35 ms
53,556 KB
testcase_06 AC 34 ms
53,556 KB
testcase_07 AC 35 ms
53,556 KB
testcase_08 AC 56 ms
68,676 KB
testcase_09 AC 52 ms
64,504 KB
testcase_10 AC 59 ms
66,628 KB
testcase_11 AC 51 ms
64,504 KB
testcase_12 AC 61 ms
70,752 KB
testcase_13 AC 234 ms
88,216 KB
testcase_14 AC 303 ms
82,164 KB
testcase_15 AC 210 ms
77,928 KB
testcase_16 AC 215 ms
77,072 KB
testcase_17 AC 219 ms
77,684 KB
testcase_18 AC 208 ms
77,776 KB
testcase_19 AC 200 ms
77,072 KB
testcase_20 AC 199 ms
77,072 KB
testcase_21 AC 206 ms
77,936 KB
testcase_22 AC 217 ms
77,936 KB
testcase_23 AC 213 ms
77,936 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 #

H, W = map(int, input().split())
A = [list(map(int, input().split())) for  _ in range(H)]
H_inv = [0]*H
W_inv = [0]*W
mod = 10**9+7
al = 1
for i in range(H):
    sm = 1
    for j in range(W):
        al *= A[i][j]
        sm *= A[i][j]
        al %= mod
        sm %= mod
    H_inv[i] = pow(sm, mod-2, mod)
for j in range(W):
    sm = 1
    for i in range(H):
        sm *= A[i][j]
        sm %= mod
    W_inv[j] = pow(sm, mod-2, mod)

Q = int(input())
for i in range(Q):
    r, c = map(int, input().split())
    print((al*H_inv[r-1]*W_inv[c-1]*A[r-1][c-1])%mod)
0