結果

問題 No.1141 田グリッド
ユーザー sepa38sepa38
提出日時 2023-03-28 10:31:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 445 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 81,584 KB
実行使用メモリ 87,852 KB
最終ジャッジ日時 2023-10-20 05:56:47
合計ジャッジ時間 9,485 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,332 KB
testcase_01 AC 39 ms
53,332 KB
testcase_02 AC 40 ms
53,332 KB
testcase_03 AC 40 ms
53,332 KB
testcase_04 AC 39 ms
53,332 KB
testcase_05 AC 40 ms
53,332 KB
testcase_06 AC 39 ms
53,332 KB
testcase_07 AC 40 ms
53,332 KB
testcase_08 AC 105 ms
66,380 KB
testcase_09 AC 59 ms
64,248 KB
testcase_10 AC 64 ms
66,380 KB
testcase_11 AC 57 ms
64,248 KB
testcase_12 AC 71 ms
68,388 KB
testcase_13 AC 320 ms
87,852 KB
testcase_14 AC 383 ms
82,248 KB
testcase_15 AC 307 ms
77,976 KB
testcase_16 AC 309 ms
77,960 KB
testcase_17 AC 312 ms
77,816 KB
testcase_18 AC 301 ms
77,828 KB
testcase_19 AC 298 ms
77,972 KB
testcase_20 AC 303 ms
77,972 KB
testcase_21 AC 313 ms
77,760 KB
testcase_22 AC 311 ms
77,764 KB
testcase_23 AC 307 ms
77,764 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 #

h, w = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(h)]
b = [1] * h
v = [1] * w
mod = 10 ** 9 + 7
s = 1
for i in range(h):
  for j in range(w):
    s *= a[i][j]
    s %= mod
    b[i] *= a[i][j]
    b[i] %= mod
    v[j] *= a[i][j]
    v[j] %= mod
for _ in range(int(input())):
  r, c = map(lambda x: int(x)-1, input().split())
  ans = s * pow(b[r], mod-2, mod) * pow(v[c], mod-2, mod) * a[r][c] % mod
  print(ans)
0