結果
問題 | No.1689 Set Cards |
ユーザー |
![]() |
提出日時 | 2021-09-24 22:03:16 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 805 bytes |
コンパイル時間 | 12,001 ms |
コンパイル使用メモリ | 387,636 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-05 10:36:26 |
合計ジャッジ時間 | 12,984 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
fn read() -> Vec<usize> { let mut s = String::new(); use std::io::Read; std::io::stdin().read_to_string(&mut s).unwrap(); let mut it = s.trim().split_whitespace(); let mut next = || it.next().unwrap().parse::<usize>().unwrap(); let n = next(); let mut a = vec![0usize; n]; for a in a.iter_mut() { let k = next(); for _ in 0..k { *a |= 1 << (next() - 1); } } a } fn run() { const MOD: u64 = 998_244_353; let a = read(); let n = 12; let mut dp = vec![0u64; 1 << n]; dp[(1 << n) - 1] = 1u64; for a in a { for i in 0..(1 << n) { dp[i & a] += dp[i]; } for dp in dp.iter_mut() { *dp %= MOD; } } println!("{}", dp[0]); } fn main() { run(); }