結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー |
|
提出日時 | 2024-08-05 15:24:41 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 124 ms / 5,000 ms |
コード長 | 526 bytes |
コンパイル時間 | 13,466 ms |
コンパイル使用メモリ | 388,156 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-08-05 15:24:57 |
合計ジャッジ時間 | 15,596 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
コンパイルメッセージ
warning: unused import: `HashMap` --> src/main.rs:1:24 | 1 | use std::collections::{HashMap, HashSet}; | ^^^^^^^ | = note: `#[warn(unused_imports)]` on by default
ソースコード
use std::collections::{HashMap, HashSet}; fn main() { proconio::input! { n: u64, a: [u64; n], } let a: HashSet<u64> = HashSet::from_iter(a); let mut dp = vec![false; 32768]; dp[0] = true; for &a in a.iter() { let mut next_dp = dp.clone(); for i in 0..dp.len() { if !dp[i] { continue; } next_dp[i ^ a as usize] = true; } dp = next_dp; } println!("{}", dp.into_iter().filter(|&x| x).count()); }