結果

問題 No.1141 田グリッド
ユーザー titiatitia
提出日時 2020-07-31 22:09:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 534 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 10,984 KB
実行使用メモリ 20,188 KB
最終ジャッジ日時 2023-09-20 23:38:35
合計ジャッジ時間 13,191 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,868 KB
testcase_01 AC 16 ms
7,808 KB
testcase_02 AC 16 ms
7,788 KB
testcase_03 AC 16 ms
7,852 KB
testcase_04 AC 16 ms
7,808 KB
testcase_05 AC 17 ms
7,928 KB
testcase_06 AC 16 ms
7,852 KB
testcase_07 AC 16 ms
7,920 KB
testcase_08 AC 22 ms
8,356 KB
testcase_09 AC 19 ms
8,220 KB
testcase_10 AC 23 ms
8,328 KB
testcase_11 AC 23 ms
8,604 KB
testcase_12 AC 22 ms
8,464 KB
testcase_13 AC 571 ms
16,596 KB
testcase_14 AC 619 ms
20,188 KB
testcase_15 AC 540 ms
12,332 KB
testcase_16 AC 541 ms
12,456 KB
testcase_17 AC 550 ms
12,244 KB
testcase_18 AC 492 ms
12,376 KB
testcase_19 AC 494 ms
12,556 KB
testcase_20 AC 506 ms
12,572 KB
testcase_21 AC 549 ms
12,472 KB
testcase_22 AC 544 ms
12,360 KB
testcase_23 AC 544 ms
12,204 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 #

import sys
input = sys.stdin.readline

H,W=map(int,input().split())
A=[list(map(int,input().split())) for i in range(H)]
mod=1000000007

HM=[-1]*H
WM=[-1]*W

for i in range(H):
    M=1
    for j in range(W):
        M=M*A[i][j]%mod
    HM[i]=M

for i in range(W):
    M=1
    for j in range(H):
        M=M*A[j][i]%mod
    WM[i]=M

M=1
for i in range(H):
    M=M*HM[i]%mod

Q=int(input())
for qu in range(Q):
    r,c=map(int,input().split())
    r-=1
    c-=1

    print(M*A[r][c]*pow(HM[r],mod-2,mod)*pow(WM[c],mod-2,mod)%mod)
    

0