結果

問題 No.1141 田グリッド
ユーザー chielochielo
提出日時 2020-07-31 21:39:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 590 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 87,276 KB
実行使用メモリ 90,148 KB
最終ジャッジ日時 2023-09-20 22:17:41
合計ジャッジ時間 10,052 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,236 KB
testcase_01 AC 72 ms
71,480 KB
testcase_02 AC 72 ms
71,324 KB
testcase_03 AC 72 ms
71,028 KB
testcase_04 AC 71 ms
71,488 KB
testcase_05 AC 72 ms
70,988 KB
testcase_06 AC 71 ms
71,316 KB
testcase_07 AC 73 ms
71,416 KB
testcase_08 AC 107 ms
76,636 KB
testcase_09 AC 98 ms
76,692 KB
testcase_10 AC 108 ms
76,644 KB
testcase_11 AC 100 ms
76,732 KB
testcase_12 AC 117 ms
78,024 KB
testcase_13 AC 320 ms
90,148 KB
testcase_14 AC 405 ms
88,512 KB
testcase_15 AC 327 ms
79,436 KB
testcase_16 AC 323 ms
79,556 KB
testcase_17 AC 329 ms
79,596 KB
testcase_18 AC 320 ms
79,712 KB
testcase_19 AC 318 ms
79,524 KB
testcase_20 AC 315 ms
79,732 KB
testcase_21 AC 314 ms
79,784 KB
testcase_22 AC 321 ms
79,636 KB
testcase_23 AC 318 ms
79,632 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 #

mo = 10 ** 9 + 7
h, w = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(h)]
b = [[pow(a[i][j], mo - 2, mo) for j in range(w)] for i in range(h)]
tpd = 1
for i in range(h):
    for j in a[i]:
        tpd *= j
        tpd %= mo
rp = [1] * h
for i in range(h):
    for j in b[i]:
        rp[i] *= j
        rp[i] %= mo
cp = [1] * w
for i in range(h):
    for j in range(w):
        cp[j] *= b[i][j]
        cp[j] %= mo
q = int(input())
for _ in range(q):
    u, v = map(int, input().split())
    print(tpd * rp[u - 1] % mo * cp[v - 1] % mo * a[u - 1][v - 1] % mo)
0