PEZZUG3QITDR5JYBRGMMM6H7J6UX4A4Y5CHKJPQSBHSQDBTQXKSQC
5OUVESUQDAEU3PEYFDXDMEULBNBJYEEHWV2LWFOOUKCTKRSZQMSAC
use std::collections::HashSet;use std::iter::once;
use std::collections::HashSet;
use std::iter::once;
let mut workspace = Vec::new(); let mut result = Vec::new();
let mut workspace = Vec::new();
let mut result = Vec::new();
let mut dag = Vec::new(); let mut descent = Vec::new();
let mut dag = Vec::new();
let mut descent = Vec::new();
while workspace.len() <= worse { workspace.push(Vec::new()); result.push(0);
while workspace.len() <= worse {
workspace.push(Vec::new());
result.push(0);
while dag.len() <= worse { dag.push(Vec::new()); descent.push(HashSet::new());
while dag.len() <= worse {
dag.push(Vec::new());
descent.push(HashSet::new());
workspace[worse].push(better);
dag[worse].push(better);
(0..workspace.len()).rev().map(|x| (x, None)).collect();
(0..dag.len()).rev().map(|x| (x, None)).collect();
let d = std::mem::take(&mut workspace[i]);
let d = std::mem::take(&mut dag[i]);
result[s] = result[s].max(result[i] + 1);
let e: HashSet<_> = once(i).chain(descent[i].iter().copied()).collect(); descent[s].extend(e);
let e: HashSet<_> =
once(i).chain(descent[i].iter().copied()).collect();
descent[s].extend(e);
result
descent.into_iter().map(|d| d.len()).collect()