結果

問題 No.1870 Xor Matrix
ユーザー 37zigen37zigen
提出日時 2023-04-13 14:17:57
言語 Scala(Beta)
(3.4.0)
結果
WA  
実行時間 -
コード長 669 bytes
コンパイル時間 8,409 ms
コンパイル使用メモリ 259,640 KB
実行使用メモリ 88,156 KB
最終ジャッジ日時 2024-04-17 18:08:27
合計ジャッジ時間 35,819 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 882 ms
63,244 KB
testcase_01 AC 858 ms
63,016 KB
testcase_02 AC 852 ms
63,128 KB
testcase_03 WA -
testcase_04 AC 1,292 ms
84,940 KB
testcase_05 AC 1,060 ms
77,060 KB
testcase_06 AC 1,260 ms
77,816 KB
testcase_07 AC 1,252 ms
79,756 KB
testcase_08 WA -
testcase_09 AC 1,070 ms
74,076 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1,107 ms
82,032 KB
testcase_13 AC 1,058 ms
73,276 KB
testcase_14 AC 1,209 ms
84,560 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1,266 ms
88,156 KB
testcase_18 WA -
testcase_19 AC 1,234 ms
81,292 KB
testcase_20 AC 1,084 ms
75,784 KB
testcase_21 AC 976 ms
69,892 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import scala.io.StdIn.readLine

object Main {
  def main(args: Array[String]): Unit = {
    val Array(n, m) = readLine().split(" ").map(_.toInt)
    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 = {
    var result = 1L
    var b = base % MOD
    var e = exp
    while (e > 0) {
      if ((e & 1) == 1) {
        result = result * b % MOD
      }
      b = b * b % MOD
      e /= 2
    }
    result
  }
}
0