結果
問題 |
No.2895 Zero XOR Subset
|
ユーザー |
|
提出日時 | 2024-10-29 18:22:37 |
言語 | Rust (1.83.0 + proconio) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,086 bytes |
コンパイル時間 | 14,038 ms |
コンパイル使用メモリ | 404,704 KB |
実行使用メモリ | 83,380 KB |
最終ジャッジ日時 | 2024-10-29 18:22:59 |
合計ジャッジ時間 | 19,934 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | TLE * 1 -- * 34 |
ソースコード
use std::collections::HashSet; use proconio::input; fn main() { input! { n:usize, mut a:[usize;n], } const D: usize = 60; let mut hists = vec![]; for i in 0..n { let mut hs = HashSet::new(); hs.insert(i); hists.push(hs); } let mut rank = 0; for col in 0..D { let Some(row)=(rank..n).find(|&row|a[row]&(1<<col)!=0)else{ continue; }; hists.swap(row, rank); a.swap(row, rank); for i in 0..n { if rank == i || a[i] & (1 << col) == 0 { continue; } a[i] ^= a[rank]; hists[i] = hists[i] .symmetric_difference(&hists[rank]) .copied() .collect::<HashSet<_>>(); } rank += 1; } if let Some(ind) = (0..n).find(|&i| a[i] == 0) { let ans = &hists[ind]; println!("{}", ans.len()); for bi in ans { print!("{} ", bi + 1); } println!(); } else { println!("-1"); } }