結果

問題 No.1141 田グリッド
ユーザー H3PO4H3PO4
提出日時 2020-07-31 21:47:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 493 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 10,824 KB
実行使用メモリ 16,932 KB
最終ジャッジ日時 2023-09-20 22:47:24
合計ジャッジ時間 18,522 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,896 KB
testcase_01 AC 15 ms
7,940 KB
testcase_02 AC 15 ms
7,944 KB
testcase_03 AC 16 ms
7,792 KB
testcase_04 AC 15 ms
7,796 KB
testcase_05 AC 16 ms
7,852 KB
testcase_06 AC 15 ms
7,896 KB
testcase_07 AC 15 ms
7,808 KB
testcase_08 AC 23 ms
8,164 KB
testcase_09 AC 20 ms
8,232 KB
testcase_10 AC 24 ms
8,180 KB
testcase_11 AC 26 ms
8,600 KB
testcase_12 AC 25 ms
8,264 KB
testcase_13 AC 806 ms
16,684 KB
testcase_14 AC 915 ms
16,932 KB
testcase_15 AC 790 ms
12,088 KB
testcase_16 AC 794 ms
11,940 KB
testcase_17 AC 793 ms
11,992 KB
testcase_18 AC 734 ms
11,976 KB
testcase_19 AC 732 ms
12,100 KB
testcase_20 AC 736 ms
11,940 KB
testcase_21 AC 792 ms
12,092 KB
testcase_22 AC 792 ms
12,380 KB
testcase_23 AC 787 ms
12,224 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 = 1000000007
modinv = lambda a, mod=MOD: pow(a, MOD - 2, mod)
int1 = lambda x: int(x) - 1

H, W = map(int, input().split())
A = [tuple(map(int, input().split())) for _ in range(H)]

R, C = [1] * H, [1] * W
P = 1
for i in range(H):
    for j in range(W):
        R[i] = R[i] * A[i][j] % MOD
        C[j] = C[j] * A[i][j] % MOD
        P = P * A[i][j] % MOD
Q = int(input())
for _ in range(Q):
    r, c = map(int1, input().split())
    print(P * modinv(R[r]) * modinv(C[c]) * A[r][c] % MOD)
0