結果
問題 | No.2134 $\sigma$-algebra over Finite Set |
ユーザー | akakimidori |
提出日時 | 2022-11-25 22:47:38 |
言語 | Rust (1.77.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,593 bytes |
コンパイル時間 | 20,239 ms |
コンパイル使用メモリ | 402,060 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-02 05:21:38 |
合計ジャッジ時間 | 14,972 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,820 KB |
testcase_01 | AC | 25 ms
6,820 KB |
testcase_02 | AC | 25 ms
6,820 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 3 ms
6,816 KB |
testcase_07 | AC | 2 ms
6,820 KB |
testcase_08 | AC | 1 ms
6,820 KB |
testcase_09 | AC | 1 ms
6,816 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 28 ms
6,816 KB |
testcase_14 | WA | - |
testcase_15 | AC | 5 ms
6,816 KB |
testcase_16 | WA | - |
testcase_17 | AC | 1 ms
6,816 KB |
testcase_18 | AC | 0 ms
6,820 KB |
コンパイルメッセージ
warning: unused variable: `out` --> src/main.rs:47:45 | 47 | fn run<W: Write>(sc: &mut scanner::Scanner, out: &mut std::io::BufWriter<W>) { | ^^^ help: if this is intentional, prefix it with an underscore: `_out` | = note: `#[warn(unused_variables)]` on by default warning: type alias `Map` is never used --> src/main.rs:33:6 | 33 | type Map<K, V> = BTreeMap<K, V>; | ^^^ | = note: `#[warn(dead_code)]` on by default warning: type alias `Set` is never used --> src/main.rs:34:6 | 34 | type Set<T> = BTreeSet<T>; | ^^^ warning: type alias `Deque` is never used --> src/main.rs:35:6 | 35 | type Deque<T> = VecDeque<T>; | ^^^^^
ソースコード
// ---------- begin scannner ---------- #[allow(dead_code)] mod scanner { use std::str::FromStr; pub struct Scanner<'a> { it: std::str::SplitWhitespace<'a>, } impl<'a> Scanner<'a> { pub fn new(s: &'a String) -> Scanner<'a> { Scanner { it: s.split_whitespace(), } } pub fn next<T: FromStr>(&mut self) -> T { self.it.next().unwrap().parse::<T>().ok().unwrap() } pub fn next_bytes(&mut self) -> Vec<u8> { self.it.next().unwrap().bytes().collect() } pub fn next_chars(&mut self) -> Vec<char> { self.it.next().unwrap().chars().collect() } pub fn next_vec<T: FromStr>(&mut self, len: usize) -> Vec<T> { (0..len).map(|_| self.next()).collect() } } } // ---------- end scannner ---------- use std::io::Write; use std::collections::*; type Map<K, V> = BTreeMap<K, V>; type Set<T> = BTreeSet<T>; type Deque<T> = VecDeque<T>; fn main() { use std::io::Read; let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); let mut sc = scanner::Scanner::new(&s); let out = std::io::stdout(); let mut out = std::io::BufWriter::new(out.lock()); run(&mut sc, &mut out); } fn run<W: Write>(sc: &mut scanner::Scanner, out: &mut std::io::BufWriter<W>) { let n: usize = sc.next(); let m: usize = sc.next(); let w = std::mem::size_of::<usize>() * 8; let len = (n + w - 1) / w; let mut mat = vec![]; mat.push(vec![0usize; len]); let mut b = vec![!0usize; len]; if len * w != n { b[len - 1] &= (1 << (n % w)) - 1; } mat.push(b); for _ in 0..m { let l = sc.next::<usize>(); let mut a = vec![0usize; len]; for _ in 0..l { let x = sc.next::<usize>() - 1; a[x / w] |= 1 << (x % w); } let mut b = a.iter().map(|a| !*a).collect::<Vec<_>>(); if len * w != n { b[len - 1] &= (1 << (n % w)) - 1; } mat.push(a); mat.push(b); } let mut a = mat; let mut ans = 1; while let Some(x) = a.iter().position(|a| a.iter().any(|a| *a > 0)) { let b = a.remove(x); let k = (0..n).find(|x| b[x / w] >> (x % w) & 1 == 1).unwrap(); for a in a.iter_mut() { if a[k / w] >> (k % w) & 1 == 1 { for (a, b) in a.iter_mut().zip(b.iter()) { *a ^= *b; } } } ans = 2 * ans % 998244353; } println!("{}", ans); }