結果

問題 No.1141 田グリッド
ユーザー hir355hir355
提出日時 2020-07-31 21:31:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 501 bytes
コンパイル時間 552 ms
コンパイル使用メモリ 10,740 KB
実行使用メモリ 20,156 KB
最終ジャッジ日時 2023-09-20 21:50:05
合計ジャッジ時間 18,629 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,900 KB
testcase_01 AC 16 ms
7,964 KB
testcase_02 AC 17 ms
7,900 KB
testcase_03 AC 16 ms
7,804 KB
testcase_04 AC 17 ms
7,980 KB
testcase_05 AC 16 ms
7,796 KB
testcase_06 AC 16 ms
7,992 KB
testcase_07 AC 16 ms
7,848 KB
testcase_08 AC 26 ms
8,188 KB
testcase_09 AC 21 ms
8,232 KB
testcase_10 AC 26 ms
8,316 KB
testcase_11 AC 28 ms
8,496 KB
testcase_12 AC 25 ms
8,236 KB
testcase_13 AC 802 ms
16,420 KB
testcase_14 AC 925 ms
20,156 KB
testcase_15 AC 781 ms
12,244 KB
testcase_16 AC 789 ms
12,248 KB
testcase_17 AC 787 ms
12,256 KB
testcase_18 AC 724 ms
12,244 KB
testcase_19 AC 724 ms
12,160 KB
testcase_20 AC 726 ms
12,128 KB
testcase_21 AC 796 ms
12,244 KB
testcase_22 AC 788 ms
12,272 KB
testcase_23 AC 782 ms
12,184 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 = 10 ** 9 + 7
h, w = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(h)]
k = 1
row = [1] * h
col = [1] * w
for i in range(h):
    for j in range(w):
        row[i] *= a[i][j]
        col[j] *= a[i][j]
        k *= a[i][j]
        row[i] %= MOD
        col[j] %= MOD
        k %= MOD
q = int(input())
for _ in range(q):
    r, c = map(int, input().split())
    print(k * pow(row[r - 1], MOD - 2, MOD) *
          pow(col[c - 1], MOD - 2, MOD) * a[r - 1][c - 1] % MOD)
0