結果

問題 No.2152 [Cherry Anniversary 2] 19 Petals of Cherry
ユーザー titia
提出日時 2022-12-09 02:49:55
言語 Rust
(1.83.0 + proconio)
結果
TLE  
実行時間 -
コード長 1,159 bytes
コンパイル時間 11,918 ms
コンパイル使用メモリ 379,432 KB
実行使用メモリ 104,368 KB
最終ジャッジ日時 2024-10-14 18:32:12
合計ジャッジ時間 45,518 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 43 TLE * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unnecessary parentheses around index expression
  --> src/main.rs:38:32
   |
38 | ...                   dp[(l^mt[j][x])][j|(1<<x)]+=dp[l][j]
   |                          ^          ^
   |
   = note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
   |
38 -                             dp[(l^mt[j][x])][j|(1<<x)]+=dp[l][j]
38 +                             dp[l^mt[j][x]][j|(1<<x)]+=dp[l][j]
   |

ソースコード

diff #

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<usize> = {
            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 l in 0..2{
                if dp[l][j]!=0{
                    for k in 1..a.len(){
                        let x=a[k]-1;

                        if j & (1<<x)==0{
                            dp[(l^mt[j][x])][j|(1<<x)]+=dp[l][j]
                        }
                    }
                }
            }
        }
    }

    println!("{} {}",dp[0][max_length-1],dp[1][max_length-1]);
}
0