fn dirac( state: ((usize, usize), (usize, usize)), cache: &mut [Option<(usize, usize)>], ) -> (usize, usize)