結果
問題 |
No.2152 [Cherry Anniversary 2] 19 Petals of Cherry
|
ユーザー |
![]() |
提出日時 | 2022-12-09 02:36:03 |
言語 | Rust (1.83.0 + proconio) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,189 bytes |
コンパイル時間 | 13,819 ms |
コンパイル使用メモリ | 385,284 KB |
実行使用メモリ | 104,432 KB |
最終ジャッジ日時 | 2024-10-14 18:31:20 |
合計ジャッジ時間 | 56,347 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 37 TLE * 12 |
ソースコード
fn main() { let max_length=524288; let mut mt=vec![vec![0;19];max_length]; for i in 0..max_length{ for x in 0..19{ let mut t=0; for y in x+1..19{ if i & (1<<y) !=0{ t+=1; } } mt[i][x]=t%2; } } let mut dp: Vec<Vec<i64>>=vec![vec![0;max_length];2]; dp[0][0]=1; for _i in 0..19{ let a: Vec<i64> = { let mut line: String = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.split_whitespace() .map(|x| x.parse().unwrap()) .collect() }; for jj in 0..max_length{ let j=max_length-1-jj; for k in 0..a.len(){ if k==0{ continue; } let x=a[k]-1; for l in 0..2{ if dp[l][j]!=0 && (j & (1<<x)==0){ dp[(l+mt[j][x as usize])%2][j|(1<<x)]+=dp[l][j] } } } } } println!("{} {}",dp[0][max_length-1],dp[1][max_length-1]); }