結果

問題 No.1870 Xor Matrix
ユーザー 37zigen37zigen
提出日時 2023-04-13 14:18:52
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 1,281 ms / 2,000 ms
コード長 670 bytes
コンパイル時間 12,147 ms
コンパイル使用メモリ 261,468 KB
実行使用メモリ 89,580 KB
最終ジャッジ日時 2024-04-17 18:09:25
合計ジャッジ時間 35,346 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 825 ms
64,892 KB
testcase_01 AC 829 ms
64,672 KB
testcase_02 AC 817 ms
64,800 KB
testcase_03 AC 1,162 ms
77,688 KB
testcase_04 AC 1,258 ms
84,744 KB
testcase_05 AC 1,043 ms
76,700 KB
testcase_06 AC 1,205 ms
80,216 KB
testcase_07 AC 1,213 ms
80,608 KB
testcase_08 AC 1,220 ms
83,600 KB
testcase_09 AC 1,080 ms
74,688 KB
testcase_10 AC 1,107 ms
80,356 KB
testcase_11 AC 1,129 ms
80,340 KB
testcase_12 AC 1,141 ms
82,160 KB
testcase_13 AC 1,058 ms
74,340 KB
testcase_14 AC 1,224 ms
85,656 KB
testcase_15 AC 1,057 ms
74,388 KB
testcase_16 AC 1,157 ms
76,852 KB
testcase_17 AC 1,281 ms
89,580 KB
testcase_18 AC 1,171 ms
79,516 KB
testcase_19 AC 1,206 ms
81,084 KB
testcase_20 AC 1,094 ms
77,724 KB
testcase_21 AC 972 ms
69,868 KB
testcase_22 AC 1,045 ms
78,164 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 = {
    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