//! The following program finds all ways to put $2n$ numbers $\\{1,1,2,2,\dots,n,n\\}$ //! into $2n$ slots $s_1,\dots,s_{2n}$ so that there are exactly $i$ numbers //! between the two appearances of $i$, for all $1\le i\le n$. This task is //! known as _Langford's problem_, since it was first described by C. D. Langford //! [[_The Mathematical Gazette_ **42** (October 1958), 228][mathgaz]]. Its encoding //! as an exact cover problem is well explained in D. E. Knuth's book //! [_The Art of Computer Programming_ **4B** (2022)][taocp4b], Part 2, page 70. //! His approach can be summarized as follows: //! //! Regard the $n$ values of $i$ and the $2n$ slots as the items to be covered. //! Then the legal options for permuting the first $n$ integers into a Langford //! sequence are $`i\\;s_j\\;s_k'$ for $1\le i\le n$, $1\le j = numbers.chain(slots).collect(); let mut solver: DlSolver = DlSolver::new(&items, &[]); for i in 1..=N { // Optimization: half of the Langford pairs for a given value of $n$ // are the reverses of the others. Reduce the search space by placing // the first 1 in position $1\le s_j