結果

問題 No.1141 田グリッド
ユーザー anagohirameanagohirame
提出日時 2020-07-31 22:06:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 513 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 89,156 KB
最終ジャッジ日時 2023-09-20 23:30:34
合計ジャッジ時間 7,140 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,400 KB
testcase_01 AC 71 ms
71,520 KB
testcase_02 AC 72 ms
71,156 KB
testcase_03 AC 71 ms
71,368 KB
testcase_04 AC 71 ms
71,284 KB
testcase_05 AC 71 ms
71,304 KB
testcase_06 AC 71 ms
71,304 KB
testcase_07 AC 72 ms
71,296 KB
testcase_08 AC 84 ms
76,748 KB
testcase_09 AC 83 ms
76,880 KB
testcase_10 AC 85 ms
76,788 KB
testcase_11 AC 83 ms
76,572 KB
testcase_12 AC 85 ms
76,676 KB
testcase_13 AC 209 ms
89,156 KB
testcase_14 AC 235 ms
84,444 KB
testcase_15 AC 200 ms
78,796 KB
testcase_16 AC 202 ms
78,784 KB
testcase_17 AC 204 ms
78,632 KB
testcase_18 AC 198 ms
79,012 KB
testcase_19 AC 196 ms
78,588 KB
testcase_20 AC 196 ms
78,964 KB
testcase_21 AC 205 ms
78,832 KB
testcase_22 AC 201 ms
78,808 KB
testcase_23 AC 204 ms
78,836 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
def input():
	return sys.stdin.buffer.readline()[:-1]

MOD = 10**9+7

H, W = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(H)]
r = [1 for _ in range(H)]
c = [1 for _ in range(W)]
tot = 1
for h in range(H):
	for w in range(W):
		r[h] *= a[h][w]
		r[h] %= MOD
		c[w] *= a[h][w]
		c[w] %= MOD
		tot *= a[h][w]
		tot %= MOD

for _ in range(int(input())):
	x, y = map(int, input().split())
	print((tot * pow(r[x-1], MOD-2, MOD) * pow(c[y-1], MOD-2, MOD) * a[x-1][y-1]) % MOD)
0