結果

問題 No.1141 田グリッド
ユーザー TsubajiroTsubajiro
提出日時 2022-05-24 00:22:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 827 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 11,876 KB
実行使用メモリ 80,020 KB
最終ジャッジ日時 2023-10-20 17:50:47
合計ジャッジ時間 10,310 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
14,548 KB
testcase_01 AC 29 ms
10,200 KB
testcase_02 AC 29 ms
10,200 KB
testcase_03 AC 30 ms
10,200 KB
testcase_04 AC 30 ms
10,200 KB
testcase_05 AC 29 ms
10,200 KB
testcase_06 AC 30 ms
10,200 KB
testcase_07 AC 30 ms
10,200 KB
testcase_08 TLE -
testcase_09 AC 754 ms
18,700 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W = list(map(int, input().split()))
A = []
for _ in range(H):
    A.append(list(map(int, input().split())))
mod = 10**9+7


AA = [[1]*(H+2)]

A[0][0]%=mod
for i in range(H):
    a=[1]
    for j in range(W):
        temp = a[-1]*A[i][j]
        #temp%=mod
        a.append(temp)
    a.append(1)
    AA.append(a)

for j in range(W+1):
    for i in range(1,H+1):
        AA[i][j]*=AA[i-1][j]
        #AA[i][j]%=mod
AA.append([1]*(H+2))
#print(AA)

Q = int(input())
for _ in range(Q):
    r,c=list(map(int, input().split()))
    #左上
    LU = AA[r-1][c-1]
    #右上
    RU = AA[r-1][W]//AA[r-1][c]
    #左下
    LB = AA[H][c-1]//AA[r][c-1]
    #右下
    RB = ((AA[H][W]*AA[r][c])//AA[r][W])//AA[H][c]
    #print(LU,RU,LB,RB)
    #print((LU*RU*LB*((AA[H][W]*AA[r][c])//AA[r][W])//AA[H][c])%mod)
    print(LU*RU*LB*RB%mod)
0