結果
問題 | No.1870 Xor Matrix |
ユーザー |
|
提出日時 | 2023-02-16 01:11:11 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 987 bytes |
コンパイル時間 | 15,654 ms |
コンパイル使用メモリ | 390,896 KB |
実行使用メモリ | 6,144 KB |
最終ジャッジ日時 | 2024-07-18 06:57:21 |
合計ジャッジ時間 | 15,963 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
const MOD: usize = 998244353; fn power(base: usize, times: usize) -> usize { if times == 0 { return 1usize; } if times == 1 { return base; } let temp = power(base, times/2); temp * temp % MOD * power(base, times%2) % MOD } fn main() { let mut nm = String::new(); std::io::stdin().read_line(&mut nm).ok(); let nm: Vec<usize> = nm.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nm[0]; let m = nm[1]; let mut a = String::new(); std::io::stdin().read_line(&mut a).ok(); let a: Vec<usize> = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let mut b = String::new(); std::io::stdin().read_line(&mut b).ok(); let b: Vec<usize> = b.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); if a.iter().fold(0usize, |x, &y| x ^ y) ^ b.iter().fold(0usize, |x, &y| x ^ y) > 0 { println!("0"); return; } println!("{}", power(1usize << 20, (n-1)*(m-1))); }