結果

問題 No.1141 田グリッド
ユーザー i524i524
提出日時 2020-08-14 14:37:53
言語 Scala(Beta)
(3.4.0)
結果
WA  
実行時間 -
コード長 808 bytes
コンパイル時間 11,490 ms
コンパイル使用メモリ 253,692 KB
実行使用メモリ 86,024 KB
最終ジャッジ日時 2024-04-18 18:36:58
合計ジャッジ時間 29,926 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 837 ms
69,396 KB
testcase_01 AC 833 ms
63,660 KB
testcase_02 AC 868 ms
63,732 KB
testcase_03 WA -
testcase_04 AC 848 ms
63,872 KB
testcase_05 AC 835 ms
63,808 KB
testcase_06 AC 825 ms
63,764 KB
testcase_07 AC 840 ms
63,800 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 TLE -
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 #

import scala.io.StdIn.readLine

object Main {
  def MOD_NUMBER = 1000000007
  def modMultiply(x: Int, y: Int): Int = {
    val result = x * y
    if (result > MOD_NUMBER) result % MOD_NUMBER else result
  }
  def main(args: Array[String]): Unit = {
    val arr = readLine().split(" ").map(_.toInt)
    val h = arr(0)
    val w = arr(1)

    val numbers = 0 until h map(_ => readLine().split(" ").map(_.toInt))
    val q = readLine().toInt
    val lines = 0 until q map(_ => readLine().split(" ").map(_.toInt))

    val rowResults = numbers map(row => row.reduceLeft(_ * _))
    lines foreach {
      case Array(row, column) => {
        val result = 0 until h filter(_ != row - 1) map(i => rowResults(i) / numbers(i)(column - 1)) reduceLeft modMultiply
        System.out.println(result)
      }
    }
  }
}
0