結果

問題 No.1870 Xor Matrix
ユーザー yudedakoyudedako
提出日時 2022-03-16 00:26:48
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 1,377 ms / 2,000 ms
コード長 820 bytes
コンパイル時間 13,352 ms
コンパイル使用メモリ 259,564 KB
実行使用メモリ 85,480 KB
最終ジャッジ日時 2023-10-23 23:55:48
合計ジャッジ時間 46,023 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 901 ms
65,092 KB
testcase_01 AC 896 ms
65,100 KB
testcase_02 AC 888 ms
65,080 KB
testcase_03 AC 1,273 ms
77,812 KB
testcase_04 AC 1,325 ms
84,540 KB
testcase_05 AC 1,103 ms
76,908 KB
testcase_06 AC 1,268 ms
78,236 KB
testcase_07 AC 1,315 ms
83,076 KB
testcase_08 AC 1,291 ms
83,504 KB
testcase_09 AC 1,143 ms
75,712 KB
testcase_10 AC 1,191 ms
80,404 KB
testcase_11 AC 1,194 ms
80,824 KB
testcase_12 AC 1,187 ms
85,344 KB
testcase_13 AC 1,145 ms
75,372 KB
testcase_14 AC 1,319 ms
85,480 KB
testcase_15 AC 1,142 ms
74,692 KB
testcase_16 AC 1,241 ms
76,476 KB
testcase_17 AC 1,377 ms
84,408 KB
testcase_18 AC 1,317 ms
78,944 KB
testcase_19 AC 1,333 ms
80,968 KB
testcase_20 AC 1,169 ms
77,956 KB
testcase_21 AC 1,052 ms
70,100 KB
testcase_22 AC 1,155 ms
78,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter
import scala.collection.mutable.*
import scala.io.StdIn.*
import scala.util.chaining.*
import scala.math.*
import scala.reflect.ClassTag
import scala.util.*
import scala.annotation.tailrec
import scala.collection.mutable

inline val MOD = 998244353
extension (base: Long)
  def powMod(exp: Long): Long =
    var result = 1L
    var b = base % MOD
    var e = exp
    while e > 0 do
      if (e & 1) == 1 then
        result = result * b % MOD
      b = b * b % MOD
      e >>= 1
    result.toInt

@main def main =
  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)(_ ^ _) then
    println((1 << 20).powMod((n - 1L) * (m - 1L)))
  else
    println(0)
0