結果

問題 No.1141 田グリッド
ユーザー H3PO4H3PO4
提出日時 2020-07-31 21:44:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 488 bytes
コンパイル時間 376 ms
コンパイル使用メモリ 10,836 KB
実行使用メモリ 16,992 KB
最終ジャッジ日時 2023-09-20 22:40:06
合計ジャッジ時間 9,351 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,816 KB
testcase_01 AC 15 ms
7,740 KB
testcase_02 AC 16 ms
7,872 KB
testcase_03 AC 16 ms
7,720 KB
testcase_04 AC 15 ms
7,744 KB
testcase_05 AC 15 ms
7,732 KB
testcase_06 AC 16 ms
7,912 KB
testcase_07 AC 16 ms
7,876 KB
testcase_08 AC 24 ms
8,252 KB
testcase_09 AC 21 ms
8,292 KB
testcase_10 AC 24 ms
8,252 KB
testcase_11 AC 26 ms
8,468 KB
testcase_12 AC 24 ms
8,292 KB
testcase_13 AC 616 ms
16,720 KB
testcase_14 AC 739 ms
16,992 KB
testcase_15 AC 609 ms
12,000 KB
testcase_16 AC 608 ms
12,052 KB
testcase_17 AC 600 ms
12,012 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 604 ms
12,136 KB
testcase_22 AC 612 ms
12,216 KB
testcase_23 AC 616 ms
12,232 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 1000000007
modinv = lambda a, mod=MOD: pow(a, -1, 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