Struct EdgeListGraphScanner
Source pub struct EdgeListGraphScanner<U: IterScan<Output = usize>, T: IterScan> { }
crates/aizu_online_judge/src/grl/grl_2_b.rs (
line 12)
9pub fn grl_2_b(reader: impl Read, mut writer: impl Write) {
10 let s = read_all_unchecked(reader);
11 let mut scanner = Scanner::new(&s);
12 scan!(scanner, vs, es, root, (graph, w): @EdgeListGraphScanner::<usize, i64>::new(vs, es));
13 let res = graph.minimum_spanning_arborescence::<AdditiveOperation<_>, _>(root, |u| w[u]);
14 writeln!(writer, "{}", res.unwrap().0).ok();
15}
More examples
Hide additional examples
crates/library_checker/src/graph/directedmst.rs (
line 9)
6pub fn directedmst(reader: impl Read, mut writer: impl Write) {
7 let s = read_all_unchecked(reader);
8 let mut scanner = Scanner::new(&s);
9 scan!(scanner, n, m, s, (graph, w): @EdgeListGraphScanner::<usize, i64>::new(n, m));
10 let res = graph
11 .minimum_spanning_arborescence::<AdditiveOperation<_>, _>(s, |u| w[u])
12 .unwrap();
13 iter_print!(writer, res.0; @it res.1);
14}
crates/aizu_online_judge/src/grl/grl_2_a.rs (
line 9)
6pub fn grl_2_a(reader: impl Read, mut writer: impl Write) {
7 let s = read_all_unchecked(reader);
8 let mut scanner = Scanner::new(&s);
9 scan!(scanner, vs, es, (graph, w): @EdgeListGraphScanner::<usize, u64>::new(vs, es));
10 let span = graph.minimum_spanning_tree(|&eid| w[eid]);
11 let ans = (0..es).map(|eid| w[eid] * span[eid] as u64).sum::<u64>();
12 writeln!(writer, "{}", ans).ok();
13}
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From<T> for U
chooses to do.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.