結果

問題 No.1141 田グリッド
ユーザー marroncastlemarroncastle
提出日時 2020-07-31 21:50:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 587 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 89,876 KB
最終ジャッジ日時 2023-09-20 22:55:54
合計ジャッジ時間 7,378 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,084 KB
testcase_01 AC 72 ms
71,380 KB
testcase_02 AC 72 ms
71,212 KB
testcase_03 AC 71 ms
71,380 KB
testcase_04 AC 71 ms
71,388 KB
testcase_05 AC 72 ms
71,232 KB
testcase_06 AC 72 ms
71,424 KB
testcase_07 AC 72 ms
71,276 KB
testcase_08 AC 93 ms
76,620 KB
testcase_09 AC 86 ms
76,300 KB
testcase_10 AC 91 ms
76,668 KB
testcase_11 AC 85 ms
76,540 KB
testcase_12 AC 99 ms
76,552 KB
testcase_13 AC 203 ms
89,876 KB
testcase_14 AC 265 ms
85,816 KB
testcase_15 AC 203 ms
81,132 KB
testcase_16 AC 208 ms
80,756 KB
testcase_17 AC 211 ms
80,828 KB
testcase_18 AC 203 ms
80,132 KB
testcase_19 AC 200 ms
80,068 KB
testcase_20 AC 199 ms
80,096 KB
testcase_21 AC 199 ms
80,928 KB
testcase_22 AC 200 ms
80,904 KB
testcase_23 AC 199 ms
80,916 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 #

def solve():
  mod = 10**9+7
  H, W = map(int, input().split())
  h_prod = [1]*H
  w_prod = [1]*W
  A = [list(map(int, input().split())) for _ in range(H)]
  for i in range(H):
    for j in range(W):
      h_prod[i] *= A[i][j]
      w_prod[j] *= A[i][j]
      h_prod[i] %= mod
      w_prod[j] %= mod
  Q = int(input())
  total = 1
  for i in range(H):
    total *= h_prod[i]
    total %= mod
  ans = [total]*Q
  for i in range(Q):
    r,c = map(int, input().split())
    ans[i] *= pow(h_prod[r-1]*w_prod[c-1],mod-2,mod)*A[r-1][c-1]
    ans[i] %= mod
  return ans
print(*solve(),sep='\n')
0