結果
| 問題 |
No.2152 [Cherry Anniversary 2] 19 Petals of Cherry
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2022-12-09 04:09:32 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 358 ms / 1,000 ms |
| コード長 | 1,392 bytes |
| コンパイル時間 | 11,372 ms |
| コンパイル使用メモリ | 379,952 KB |
| 実行使用メモリ | 109,416 KB |
| 最終ジャッジ日時 | 2024-10-14 18:33:05 |
| 合計ジャッジ時間 | 25,246 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 49 |
ソースコード
fn main() {
let max_length=524288;
let mut mt=vec![vec![0;19];max_length];
let mut tos=vec![Vec::new();20];
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;
}
}
for i in 0..max_length{
let mut u=0;
for j in 0..19{
if i & (1<<j)!=0{
u+=1;
}
}
tos[u].push(i);
}
for i in 0..20{
tos[i].reverse();
}
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 j in tos[i].clone(){
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]);
}
titia