[−][src]Trait contest_algorithms::range_query::sqrt_decomp::MoState
A generic implementation of Mo's algorithm, aka Query Sqrt Decomposition. It answers q offline queries over intervals in 0..n by shifting the query interval's endpoints by one position at a time. Each endpoint incurs a total cost of at most n * sqrt(q * L_OP * R_OP).
Associated Types
Loading content...Associated Constants
Loading content...Required methods
fn query(&self, q: &Self::Q) -> Self::A
fn insert_left(&mut self, pos: usize)
fn remove_left(&mut self, pos: usize)
Provided methods
fn insert_right(&mut self, pos: usize)
fn remove_right(&mut self, pos: usize)
fn process(&mut self, queries: &[(usize, usize, Self::Q)]) -> Vec<Self::A>
After initializing self to a state corresponding to an empty interval, call this function to answer all your queries.