結果

問題 No.1870 Xor Matrix
ユーザー 37zigen37zigen
提出日時 2023-04-13 14:16:50
言語 Scala(Beta)
(3.4.0)
結果
WA  
実行時間 -
コード長 674 bytes
コンパイル時間 13,101 ms
コンパイル使用メモリ 254,864 KB
実行使用メモリ 88,824 KB
最終ジャッジ日時 2024-04-17 18:07:27
合計ジャッジ時間 44,606 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 925 ms
63,096 KB
testcase_01 AC 938 ms
63,160 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1,407 ms
84,832 KB
testcase_05 WA -
testcase_06 AC 1,418 ms
78,560 KB
testcase_07 AC 1,396 ms
79,964 KB
testcase_08 WA -
testcase_09 AC 1,211 ms
74,124 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1,321 ms
82,192 KB
testcase_13 AC 1,174 ms
73,020 KB
testcase_14 AC 1,396 ms
84,616 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1,444 ms
88,824 KB
testcase_18 WA -
testcase_19 AC 1,413 ms
81,112 KB
testcase_20 AC 1,198 ms
75,840 KB
testcase_21 WA -
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, 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