diff --git a/dependencies.js b/dependencies.js index b5e45c08..d6cbe43d 100644 --- a/dependencies.js +++ b/dependencies.js @@ -1 +1 @@ -dependencies = {"fp":{"dependencies":[],"tags":[]},"bitutils":{"dependencies":[],"tags":[]},"elim":{"dependencies":[],"tags":[]},"two_sat":{"dependencies":["scc"],"tags":[]},"segbeats_task3":{"dependencies":["open"],"tags":[]},"rbtree":{"dependencies":[],"tags":[]},"bfs":{"dependencies":[],"tags":[]},"segbeats":{"dependencies":["open"],"tags":[]},"tree_fold":{"dependencies":[],"tags":[]},"gridnei":{"dependencies":[],"tags":[]},"io":{"dependencies":[],"tags":[]},"interval_heap":{"dependencies":[],"tags":[]},"bfs01":{"dependencies":[],"tags":[]},"reverse":{"dependencies":[],"tags":[]},"swag":{"dependencies":[],"tags":[]},"avl_tree":{"dependencies":[],"tags":[]},"open":{"dependencies":[],"tags":[]},"monotone_minima":{"dependencies":[],"tags":[]},"itermore":{"dependencies":[],"tags":[]},"zeta":{"dependencies":[],"tags":[]},"bsgs":{"dependencies":[],"tags":[]},"fps":{"dependencies":["fp"],"tags":[]},"gco":{"dependencies":["dinic"],"tags":[]},"lg":{"dependencies":[],"tags":[]},"low_link":{"dependencies":[],"tags":[]},"lazy_segtree":{"dependencies":[],"tags":[]},"union_find":{"dependencies":[],"tags":[]},"poly":{"dependencies":[],"tags":[]},"next_permutation":{"dependencies":[],"tags":[]},"dual_segtree":{"dependencies":[],"tags":[]},"cht":{"dependencies":[],"tags":[]},"suffix_sum":{"dependencies":[],"tags":[]},"hld":{"dependencies":[],"tags":[]},"rational":{"dependencies":[],"tags":[]},"hungarian":{"dependencies":[],"tags":[]},"skew-heap":{"dependencies":[],"tags":[]},"heap_slope_trick":{"dependencies":[],"tags":[]},"dfs":{"dependencies":[],"tags":[]},"cmpmore":{"dependencies":[],"tags":[]},"slicemore":{"dependencies":[],"tags":[]},"wavelet_matrix":{"dependencies":[],"tags":[]},"z_algo":{"dependencies":[],"tags":[]},"not_nan":{"dependencies":[],"tags":[]},"uf_checklist":{"dependencies":["union_find"],"tags":[]},"splay_tree":{"dependencies":[],"tags":[]},"mincost_flow":{"dependencies":[],"tags":[]},"space":{"dependencies":[],"tags":[]},"gss":{"dependencies":[],"tags":[]},"advance":{"dependencies":[],"tags":[]},"convex_hull":{"dependencies":[],"tags":[]},"bitvec":{"dependencies":[],"tags":[]},"segtree":{"dependencies":[],"tags":[]},"filter_position":{"dependencies":[],"tags":[]},"lazy_segbeats":{"dependencies":["open"],"tags":[]},"max_flow":{"dependencies":[],"tags":[]},"sort_tree":{"dependencies":[],"tags":[]},"sparse_table":{"dependencies":[],"tags":[]},"binary":{"dependencies":[],"tags":[]},"rb":{"dependencies":[],"tags":[]},"make_graph":{"dependencies":[],"tags":[]},"euclid":{"dependencies":[],"tags":[]},"cipolla":{"dependencies":[],"tags":[]},"inversion_number":{"dependencies":[],"tags":[]},"lin_ineq":{"dependencies":[],"tags":[]},"dinic":{"dependencies":[],"tags":[]},"trial":{"dependencies":[],"tags":[]},"trie":{"dependencies":[],"tags":[]},"dial":{"dependencies":[],"tags":[]},"newton":{"dependencies":[],"tags":[]},"erato":{"dependencies":[],"tags":[]},"hopkarp":{"dependencies":[],"tags":[]},"veb":{"dependencies":[],"tags":[]},"radix_heap":{"dependencies":[],"tags":[]},"accum":{"dependencies":[],"tags":[]},"numeric_search":{"dependencies":[],"tags":[]},"scc":{"dependencies":[],"tags":[]},"manacher":{"dependencies":[],"tags":[]},"dijkstra_radix_heap":{"dependencies":["radix_heap"],"tags":[]},"suffix_array":{"dependencies":[],"tags":[]},"heap_tricks":{"dependencies":[],"tags":[]},"partially_persistent_union_find":{"dependencies":[],"tags":[]},"randtools":{"dependencies":[],"tags":[]},"vec_lines":{"dependencies":[],"tags":[]},"lagrange":{"dependencies":["fp"],"tags":[]}} \ No newline at end of file +dependencies = {"euclid":{"dependencies":[],"tags":[]},"bitvec":{"dependencies":[],"tags":[]},"fps":{"dependencies":["fp"],"tags":[]},"interval_heap":{"dependencies":[],"tags":[]},"max_flow":{"dependencies":[],"tags":[]},"union_find":{"dependencies":[],"tags":[]},"bitutils":{"dependencies":[],"tags":[]},"rbtree":{"dependencies":[],"tags":[]},"wavelet_matrix":{"dependencies":[],"tags":[]},"make_graph":{"dependencies":[],"tags":[]},"lg":{"dependencies":[],"tags":[]},"suffix_array":{"dependencies":[],"tags":[]},"lagrange":{"dependencies":["fp"],"tags":[]},"cht":{"dependencies":[],"tags":[]},"two_sat":{"dependencies":["scc"],"tags":[]},"z_algo":{"dependencies":[],"tags":[]},"gridnei":{"dependencies":[],"tags":[]},"inversion_number":{"dependencies":[],"tags":[]},"gss":{"dependencies":[],"tags":[]},"advance":{"dependencies":[],"tags":[]},"binary":{"dependencies":[],"tags":[]},"open":{"dependencies":[],"tags":[]},"cipolla":{"dependencies":[],"tags":[]},"next_permutation":{"dependencies":[],"tags":[]},"numeric_search":{"dependencies":[],"tags":[]},"segtree":{"dependencies":[],"tags":[]},"hopkarp":{"dependencies":[],"tags":[]},"scc":{"dependencies":[],"tags":[]},"mincost_flow":{"dependencies":[],"tags":[]},"space":{"dependencies":[],"tags":[]},"fp":{"dependencies":[],"tags":[]},"monotone_minima":{"dependencies":[],"tags":[]},"elim":{"dependencies":[],"tags":[]},"itermore":{"dependencies":[],"tags":[]},"dijkstra_radix_heap":{"dependencies":["radix_heap"],"tags":[]},"veb":{"dependencies":[],"tags":[]},"rb":{"dependencies":[],"tags":[]},"bfs":{"dependencies":[],"tags":[]},"segbeats":{"dependencies":["open"],"tags":[]},"lazy_segbeats":{"dependencies":["open"],"tags":[]},"dfs":{"dependencies":[],"tags":[]},"avl_tree":{"dependencies":[],"tags":[]},"hungarian":{"dependencies":[],"tags":[]},"tree_fold":{"dependencies":[],"tags":[]},"io":{"dependencies":[],"tags":[]},"trial":{"dependencies":[],"tags":[]},"poly":{"dependencies":[],"tags":[]},"uf_checklist":{"dependencies":["union_find"],"tags":[]},"lazy_segtree":{"dependencies":[],"tags":[]},"dial":{"dependencies":[],"tags":[]},"erato":{"dependencies":[],"tags":[]},"dinic":{"dependencies":[],"tags":[]},"dual_segtree":{"dependencies":[],"tags":[]},"swag":{"dependencies":[],"tags":[]},"heap_tricks":{"dependencies":[],"tags":[]},"zeta":{"dependencies":[],"tags":[]},"radix_heap":{"dependencies":[],"tags":[]},"filter_position":{"dependencies":[],"tags":[]},"bsgs":{"dependencies":[],"tags":[]},"skew-heap":{"dependencies":[],"tags":[]},"sparse_table":{"dependencies":[],"tags":[]},"cmpmore":{"dependencies":[],"tags":[]},"not_nan":{"dependencies":[],"tags":[]},"reverse":{"dependencies":[],"tags":[]},"newton":{"dependencies":[],"tags":[]},"suffix_sum":{"dependencies":[],"tags":[]},"bfs01":{"dependencies":[],"tags":[]},"sort_tree":{"dependencies":[],"tags":[]},"heap_slope_trick":{"dependencies":[],"tags":[]},"gco":{"dependencies":["dinic"],"tags":[]},"splay_tree":{"dependencies":[],"tags":[]},"hld":{"dependencies":[],"tags":[]},"accum":{"dependencies":[],"tags":[]},"lin_ineq":{"dependencies":[],"tags":[]},"segbeats_task3":{"dependencies":["open"],"tags":[]},"partially_persistent_union_find":{"dependencies":[],"tags":[]},"randtools":{"dependencies":[],"tags":[]},"slicemore":{"dependencies":[],"tags":[]},"rational":{"dependencies":[],"tags":[]},"low_link":{"dependencies":[],"tags":[]},"vec_lines":{"dependencies":[],"tags":[]},"convex_hull":{"dependencies":[],"tags":[]},"trie":{"dependencies":[],"tags":[]},"manacher":{"dependencies":[],"tags":[]}} \ No newline at end of file diff --git a/help.html b/help.html index cc22d4a2..ab44fa7f 100644 --- a/help.html +++ b/help.html @@ -1,4 +1,4 @@ -
van Leeuwen, Jan, and Derick Wood. “Interval heaps.” The Computer Journal 36.3 (1993): 209-216.
IntervalHeap
pub struct IntervalHeap<T: Ord> { /* private fields */ }
Interval heap (double-ended priority queue)
+pub struct IntervalHeap<T: Ord> { /* private fields */ }
Interval heap (double-ended priority queue)
source
. Read moreself
and other
values to be equal, and is used
+source
. Read moreextend_one
)extend_one
)self
and other
values to be equal, and is used
by ==
.x
の隣接頂点のうち、toward
…","3 つの頂点番号 a
, b
, c
について、b
が a
と c
…","","","","","","","親を消したグラフを返します。","","","","","","","","2 …","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","頂点番号から、Heavy path …","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","","","頂点 u
, v
が隣接頂点であれば true
…","p
が u
の祖先であれば true
、さもなくば false
…","Self::iter_v
とほぼ同様ですが、LCA …","2 つの頂点番号から、その間のパスを Heavy …","2 つの頂点番号から、LCA …","HLD …","","","…","…","…","…","","","","","","","","","","","",""],"i":[0,0,0,1,1,1,4,5,1,4,5,1,1,4,5,1,4,5,1,1,1,4,5,1,4,5,1,4,5,1,4,5,1,1,4,5,4,5,1,1,1,1,1,1,4,5,1,1,1,1,1,4,5,1,4,5,1,4,5,1,4,5],"f":[0,0,0,[[1,2,2],2],[[1,2,2,2],3],[[]],[[]],[[]],[[]],[[]],[[]],[1],[1,1],[4,4],[5,5],[[]],[[]],[[]],[[],1],[[1,2,2],2],[[1,1],3],[[4,4],3],[[5,5],3],[[1,6],7],[[4,6],7],[[5,6],7],[[]],[[]],[[]],[[1,8]],[[4,8]],[[5,8]],[1],[[]],[[]],[[]],[[]],[[]],[[1,2,2],3],[[1,2,2],3],[[1,2,2],5],[[1,2,2],4],[[1,2,2],2],[2,1],[4,9],[5,9],[1],[1],[1],[1],[[]],[[]],[[]],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],11],[[],11],[[],11]],"c":[],"p":[[3,"Hld"],[15,"usize"],[15,"bool"],[3,"IterV"],[3,"IterE"],[3,"Formatter"],[6,"Result"],[8,"Hasher"],[4,"Option"],[4,"Result"],[3,"TypeId"]]},\
"hopkarp":{"doc":"Finds a maximum cardinality bipartite matching by …","t":"DMLLLLMLLLMLLFLMMLLLL","n":["HopkarpResult","backward","borrow","borrow_mut","clone","clone_into","count","default","eq","fmt","forward","from","hash","hopkarp","into","left","right","to_owned","try_from","try_into","type_id"],"q":[[0,"hopkarp"]],"d":["Summary of the result of Hopcroft―Karp’s algorithm.","","","","","","Cardinality of a maximum cardinality bipartite matching.","","","","","Returns the argument unchanged.","","Takes a forward adjacency list and the length of the right …","Calls U::from(self)
.","","","","","",""],"i":[0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1],"f":[0,0,[[]],[[]],[1,1],[[]],0,[[],1],[[1,1],2],[[1,3],4],0,[[]],[[1,5]],[6,1],[[]],0,0,[[]],[[],7],[[],7],[[],8]],"c":[],"p":[[3,"HopkarpResult"],[15,"bool"],[3,"Formatter"],[6,"Result"],[8,"Hasher"],[15,"usize"],[4,"Result"],[3,"TypeId"]]},\
"hungarian":{"doc":"Solve an assignment problem by Hungarian algorithm.","t":"DIMLLLLLLMLFKLMMLLLLMK","n":["HungarianResult","Value","backward","borrow","borrow_mut","clone","clone_into","eq","fmt","forward","from","hungarian","infinity","into","left","right","to_owned","try_from","try_into","type_id","value","zero"],"q":[[0,"hungarian"]],"d":["A value object to represent the optimal solution of an …","A trait to adapt a value type to hungarian
","Takes the second component of a match and returns the …","","","","","","","Takes the first component of a match and returns the …","Returns the argument unchanged.","See the crate level documentation","","Calls U::from(self)
.","A left half of an optimal potential.","A right half of an optimal potential.","","","","","The value of an optimal solution.",""],"i":[0,0,3,3,3,3,3,3,3,3,3,0,2,3,3,3,3,3,3,3,3,2],"f":[0,0,0,[[]],[[]],[[[3,[[0,[1,2]]]]],[[3,[[0,[1,2]]]]]],[[]],[[[3,[[0,[4,2]]]],[3,[[0,[4,2]]]]],5],[[[3,[[0,[6,2]]]],7],8],0,[[]],[[],[[3,[2]]]],[[]],[[]],0,0,[[]],[[],9],[[],9],[[],10],0,[[]]],"c":[],"p":[[8,"Clone"],[8,"Value"],[3,"HungarianResult"],[8,"PartialEq"],[15,"bool"],[8,"Debug"],[3,"Formatter"],[6,"Result"],[4,"Result"],[3,"TypeId"]]},\
-"interval_heap":{"doc":"Interval Heaps","t":"DLLLLLLLLLLLLLLLLLLLL","n":["IntervalHeap","borrow","borrow_mut","clone","clone_into","default","eq","fmt","from","from","into","new","peek_max","peek_min","pop_max","pop_min","push","to_owned","try_from","try_into","type_id"],"q":[[0,"interval_heap"]],"d":["Interval heap (double-ended priority queue)","","","","","","","","Returns the argument unchanged.","","Calls U::from(self)
.","Constructs a new, empty interval heap.","Returns $\\\\max(S)$.","Returns $\\\\min(S)$.","Removes and returns $\\\\max(S)$.","Removes and returns $\\\\min(S)$.","$S \\\\leftarrow S \\\\cup \\\\{\\\\!\\\\{x\\\\}\\\\!\\\\}$.","","","",""],"i":[0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3],"f":[0,[[]],[[]],[[[3,[[0,[1,2]]]]],[[3,[[0,[1,2]]]]]],[[]],[[],[[3,[2]]]],[[[3,[[0,[4,2]]]],[3,[[0,[4,2]]]]],5],[[[3,[[0,[6,2]]]],7],8],[[]],[[[9,[[0,[2,6]]]]],[[3,[[0,[2,6]]]]]],[[]],[[],[[3,[2]]]],[[[3,[2]]],[[10,[2]]]],[[[3,[2]]],[[10,[2]]]],[[[3,[2]]],[[10,[2]]]],[[[3,[2]]],[[10,[2]]]],[[[3,[2]],2]],[[]],[[],11],[[],11],[[],12]],"c":[],"p":[[8,"Clone"],[8,"Ord"],[3,"IntervalHeap"],[8,"PartialEq"],[15,"bool"],[8,"Debug"],[3,"Formatter"],[6,"Result"],[3,"Vec"],[4,"Option"],[4,"Result"],[3,"TypeId"]]},\
+"interval_heap":{"doc":"Interval Heaps","t":"DLLLLLLLLLLLLLLLLLLLLLLL","n":["IntervalHeap","borrow","borrow_mut","clone","clone_into","default","eq","extend","fmt","from","from","from_iter","into","into_iter","new","peek_max","peek_min","pop_max","pop_min","push","to_owned","try_from","try_into","type_id"],"q":[[0,"interval_heap"]],"d":["Interval heap (double-ended priority queue)","","","","","","","","","","Returns the argument unchanged.","","Calls U::from(self)
.","","Constructs a new, empty interval heap.","Returns $\\\\max(S)$.","Returns $\\\\min(S)$.","Removes and returns $\\\\max(S)$.","Removes and returns $\\\\min(S)$.","$S \\\\leftarrow S \\\\cup \\\\{\\\\!\\\\{x\\\\}\\\\!\\\\}$.","","","",""],"i":[0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3],"f":[0,[[]],[[]],[[[3,[[0,[1,2]]]]],[[3,[[0,[1,2]]]]]],[[]],[[],[[3,[2]]]],[[[3,[[0,[4,2]]]],[3,[[0,[4,2]]]]],5],[[[3,[2]],6]],[[[3,[[0,[7,2]]]],8],9],[[[10,[2]]],[[3,[2]]]],[[]],[6,[[3,[2]]]],[[]],[[[3,[2]]]],[[],[[3,[2]]]],[[[3,[2]]],[[11,[2]]]],[[[3,[2]]],[[11,[2]]]],[[[3,[2]]],[[11,[2]]]],[[[3,[2]]],[[11,[2]]]],[[[3,[2]],2]],[[]],[[],12],[[],12],[[],13]],"c":[],"p":[[8,"Clone"],[8,"Ord"],[3,"IntervalHeap"],[8,"PartialEq"],[15,"bool"],[8,"IntoIterator"],[8,"Debug"],[3,"Formatter"],[6,"Result"],[3,"Vec"],[4,"Option"],[4,"Result"],[3,"TypeId"]]},\
"inversion_number":{"doc":"Calculates the number of inversions.","t":"F","n":["inversion_number"],"q":[[0,"inversion_number"]],"d":["Takes a sequence of numbers in 0..value_limit
and returns …"],"i":[0],"f":[[1,2]],"c":[],"p":[[15,"usize"],[15,"u64"]]},\
"io":{"doc":"Read input from stdin and parse it.","t":"IFK","n":["ParseLine","input","parse_line"],"q":[[0,"io"]],"d":["Trait for types that can be parsed.","Read input from stdin and parse it.",""],"i":[0,0,1],"f":[0,[[],1],[2]],"c":[],"p":[[8,"ParseLine"],[15,"str"]]},\
"itermore":{"doc":"An extension trait of Iterator
","t":"DIDDDLLLLLLLLFKLLLLLLLLLLLLLLLLFKLLLLFKLLLLLLLLFKLLLLLLLLLLLLLLLL","n":["ClosedPrefixSum","IterMore","MaxDecrease","MaxIncrease","OpenPrefixSum","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","closed_prefix_sum","closed_prefix_sum","closed_prefix_sum","closed_prefix_sum","closed_prefix_sum","closed_prefix_sum","from","from","from","from","into","into","into","into","into_iter","into_iter","into_iter","into_iter","max_decrease","max_decrease","max_decrease","max_decrease","max_decrease","max_decrease","max_increase","max_increase","max_increase","max_increase","max_increase","max_increase","next","next","next","next","open_prefix_sum","open_prefix_sum","open_prefix_sum","open_prefix_sum","open_prefix_sum","open_prefix_sum","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id"],"q":[[0,"itermore"]],"d":["Return value of closed_prefix_sum
.","An extension trait of Iterator
","Return value of max_decrease
.","Return value of max_increase
.","Return value of open_prefix_sum
.","","","","","","","","","Returns $\\\\sum \\\\left \\\\lbrace a _ j \\\\vert 0 \\\\le j \\\\le i …","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","","","","","Returns $\\\\max \\\\left \\\\lbrace a _ j \\\\vert 0 \\\\le j \\\\le i …","","","","","","Returns $a _ i - \\\\min \\\\left \\\\lbrace a _ j \\\\vert 0 \\\\le j …","","","","","","","","","","Returns $\\\\sum \\\\left \\\\lbrace a _ j \\\\vert 0 \\\\le j \\\\lt i …","","","","","","","","","","","","","","","","",""],"i":[0,0,0,0,0,6,2,4,3,6,2,4,3,0,10,6,2,4,3,6,2,4,3,6,2,4,3,6,2,4,3,0,10,6,2,4,3,0,10,6,2,4,3,6,2,4,3,0,10,6,2,4,3,6,2,4,3,6,2,4,3,6,2,4,3],"f":[0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[1,2],[[],2],[[],2],[[],2],[[],2],[[],2],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[1,3],[[],3],[[],3],[[],3],[[],3],[[],3],[1,4],[[],4],[[],4],[[],4],[[],4],[[],4],[[[6,[5]]],7],[[[2,[5]]],7],[[[4,[5]]],7],[[[3,[5]]],7],[1,6],[[],6],[[],6],[[],6],[[],6],[[],6],[[],8],[[],8],[[],8],[[],8],[[],8],[[],8],[[],8],[[],8],[[],9],[[],9],[[],9],[[],9]],"c":[],"p":[[8,"IntoIterator"],[3,"ClosedPrefixSum"],[3,"MaxDecrease"],[3,"MaxIncrease"],[8,"Iterator"],[3,"OpenPrefixSum"],[4,"Option"],[4,"Result"],[3,"TypeId"],[8,"IterMore"]]},\
diff --git a/settings.html b/settings.html
index 38ec7867..ef1a6432 100644
--- a/settings.html
+++ b/settings.html
@@ -1,4 +1,4 @@
-//! # Interval Heaps
//!
//! van Leeuwen, Jan, and Derick Wood. "Interval heaps." The Computer Journal 36.3 (1993): 209-216.
@@ -364,13 +380,35 @@
Self { values: Vec::new() }
}
}
-impl<T: Ord + std::fmt::Debug> From<Vec<T>> for IntervalHeap<T> {
+impl<T: Ord> From<Vec<T>> for IntervalHeap<T> {
fn from(values: Vec<T>) -> Self {
- let mut result = Self::new();
+ let mut ret = Self::new();
for x in values {
- result.push(x);
+ ret.push(x);
}
- result
+ ret
+ }
+}
+impl<T: Ord> Extend<T> for IntervalHeap<T> {
+ fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) {
+ for x in iter {
+ self.push(x);
+ }
+ }
+}
+impl<T: Ord> IntoIterator for IntervalHeap<T> {
+ type IntoIter = std::vec::IntoIter<T>;
+ type Item = T;
+
+ fn into_iter(self) -> Self::IntoIter {
+ self.values.into_iter()
+ }
+}
+impl<T: Ord> std::iter::FromIterator<T> for IntervalHeap<T> {
+ fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self {
+ let mut ret = Self::new();
+ ret.extend(iter);
+ ret
}
}
@@ -486,19 +524,17 @@
fn test_interval_heap() {
let mut rng = StdRng::seed_from_u64(42);
for _ in 0..100 {
- let n = rng.gen_range(0..4);
+ let n = rng.gen_range(0..10);
let q = rng.gen_range(10..100);
let lim = rng.gen_range(1..=n + q + 10);
let mut vec = (0..n).map(|_| rng.gen_range(0..lim)).collect::<Vec<_>>();
let mut interval_heap = IntervalHeap::from(vec.clone());
vec.sort_unstable();
- eprintln!("vec = {:?}", vec);
for _ in 0..q {
match rng.gen_range(0..3) {
// push
0 => {
let x = rng.gen_range(0..lim);
- eprintln!("push {}", x);
interval_heap.push(x);
let i = vec.binary_search(&x).unwrap_or_else(|x| x);
vec.insert(i, x);
@@ -506,7 +542,6 @@
}
// pop_min
1 => {
- eprintln!("pop_min");
if let Some(x) = interval_heap.pop_min() {
assert_eq!(x, vec.remove(0));
validate_interval_heap(&interval_heap);
@@ -516,7 +551,6 @@
}
// pop_max
2 => {
- eprintln!("pop_max");
if let Some(x) = interval_heap.pop_max() {
assert_eq!(x, vec.pop().unwrap());
validate_interval_heap(&interval_heap);
@@ -526,9 +560,7 @@
}
_ => unreachable!(),
}
- eprintln!("vec = {:?}", &vec);
}
- eprintln!("---");
}
}
}