結果

問題 No.1141 田グリッド
ユーザー rlangevinrlangevin
提出日時 2023-01-31 00:05:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 644 bytes
コンパイル時間 1,523 ms
コンパイル使用メモリ 86,844 KB
実行使用メモリ 89,452 KB
最終ジャッジ日時 2023-09-12 20:15:02
合計ジャッジ時間 11,191 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,308 KB
testcase_01 AC 71 ms
71,120 KB
testcase_02 AC 70 ms
71,264 KB
testcase_03 AC 71 ms
70,952 KB
testcase_04 AC 70 ms
71,320 KB
testcase_05 AC 72 ms
71,316 KB
testcase_06 AC 71 ms
71,116 KB
testcase_07 AC 70 ms
71,208 KB
testcase_08 AC 95 ms
76,808 KB
testcase_09 AC 92 ms
76,820 KB
testcase_10 AC 94 ms
77,032 KB
testcase_11 AC 93 ms
76,740 KB
testcase_12 AC 96 ms
76,880 KB
testcase_13 AC 285 ms
89,452 KB
testcase_14 AC 338 ms
84,536 KB
testcase_15 AC 238 ms
79,148 KB
testcase_16 AC 240 ms
79,224 KB
testcase_17 AC 247 ms
79,460 KB
testcase_18 AC 225 ms
79,224 KB
testcase_19 AC 231 ms
79,564 KB
testcase_20 AC 233 ms
79,336 KB
testcase_21 AC 240 ms
79,024 KB
testcase_22 AC 245 ms
78,992 KB
testcase_23 AC 239 ms
78,940 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())
mod = 10 ** 9 + 7
A = []
ans = 1
for i in range(H):
    A.append(list(map(int, input().split())))
    for j in range(W):
        ans *= A[i][j]
        ans %= mod
        
DH, DW = [1] * H, [1] * W
for i in range(H):
    for j in range(W):
        DH[i] *= A[i][j]
        DH[i] %= mod
        DW[j] *= A[i][j]
        DW[j] %= mod
    
for i in range(H):
    DH[i] = pow(DH[i], mod - 2, mod)
for j in range(W):
    DW[j] = pow(DW[j], mod - 2, mod)
        
    
Q = int(input())
for i in range(Q):
    r, c = map(int, input().split())
    r, c = r - 1 , c - 1
    print(ans * DH[r] * DW[c] * A[r][c] % mod)    
0