結果

問題 No.1870 Xor Matrix
ユーザー 37zigen37zigen
提出日時 2023-04-13 14:28:05
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 1,249 ms / 2,000 ms
コード長 589 bytes
コンパイル時間 13,280 ms
コンパイル使用メモリ 258,892 KB
実行使用メモリ 89,820 KB
最終ジャッジ日時 2024-04-17 18:19:10
合計ジャッジ時間 34,940 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 806 ms
64,720 KB
testcase_01 AC 823 ms
64,944 KB
testcase_02 AC 833 ms
64,640 KB
testcase_03 AC 1,193 ms
77,656 KB
testcase_04 AC 1,236 ms
84,672 KB
testcase_05 AC 1,022 ms
76,856 KB
testcase_06 AC 1,175 ms
80,404 KB
testcase_07 AC 1,179 ms
80,532 KB
testcase_08 AC 1,202 ms
83,668 KB
testcase_09 AC 1,056 ms
74,896 KB
testcase_10 AC 1,075 ms
80,444 KB
testcase_11 AC 1,096 ms
80,548 KB
testcase_12 AC 1,117 ms
82,064 KB
testcase_13 AC 1,044 ms
74,292 KB
testcase_14 AC 1,208 ms
85,872 KB
testcase_15 AC 1,074 ms
74,300 KB
testcase_16 AC 1,148 ms
76,736 KB
testcase_17 AC 1,249 ms
89,820 KB
testcase_18 AC 1,160 ms
79,620 KB
testcase_19 AC 1,240 ms
80,928 KB
testcase_20 AC 1,108 ms
77,864 KB
testcase_21 AC 985 ms
70,012 KB
testcase_22 AC 1,067 ms
78,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import scala.io.StdIn.readLine

object Main {
  def main(args: Array[String]): Unit = {
    val Array(n, m) = readLine().split(" ").map(_.toLong)
    val row = readLine().split(" ").map(_.toInt)
    val column = readLine().split(" ").map(_.toInt)
    if (row.fold(0)(_ ^ _) == column.fold(0)(_ ^ _)) {
      println(powMod(1 << 20, (n - 1) * (m - 1)))
    } else {
      println(0)
    }
  }

  val MOD = 998244353;

  def powMod(base : Long, exp : Long): Long = {
    if (exp == 0) 1
    else {
      (if (exp % 2 == 1) base else 1) * powMod(base * base % MOD, exp / 2) % MOD
    }
  }
}
0