結果

問題 No.1141 田グリッド
ユーザー ayaoniayaoni
提出日時 2021-01-01 23:07:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 965 bytes
コンパイル時間 792 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 89,216 KB
最終ジャッジ日時 2024-04-19 20:05:49
合計ジャッジ時間 6,935 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,608 KB
testcase_01 AC 34 ms
52,736 KB
testcase_02 AC 34 ms
52,608 KB
testcase_03 AC 35 ms
52,480 KB
testcase_04 AC 34 ms
52,608 KB
testcase_05 AC 35 ms
52,224 KB
testcase_06 AC 34 ms
52,352 KB
testcase_07 AC 36 ms
52,352 KB
testcase_08 AC 48 ms
64,256 KB
testcase_09 AC 47 ms
62,720 KB
testcase_10 AC 49 ms
64,128 KB
testcase_11 AC 47 ms
63,104 KB
testcase_12 AC 52 ms
65,408 KB
testcase_13 AC 185 ms
89,216 KB
testcase_14 AC 218 ms
84,760 KB
testcase_15 AC 174 ms
77,568 KB
testcase_16 AC 174 ms
77,568 KB
testcase_17 AC 180 ms
77,568 KB
testcase_18 AC 165 ms
77,568 KB
testcase_19 AC 165 ms
77,952 KB
testcase_20 AC 167 ms
77,488 KB
testcase_21 AC 178 ms
77,932 KB
testcase_22 AC 175 ms
77,568 KB
testcase_23 AC 174 ms
77,568 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

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


H,W = MI()
A = [LI() for _ in range(H)]
mod = 10**9+7

row = []
for i in range(H):
    a = 1
    for j in range(W):
        a *= A[i][j]
        a %= mod
    row.append(a)

column = []
for j in range(W):
    a = 1
    for i in range(H):
        a *= A[i][j]
        a %= mod
    column.append(a)

p = 1
for i in range(H):
    p *= row[i]
    p %= mod

Q = I()
for _ in range(Q):
    r,c = MI()
    r -= 1
    c -= 1
    ans = p*A[r][c]*pow(row[r],mod-2,mod)*pow(column[c],mod-2,mod)
    ans %= mod
    print(ans)
0