Struct ZeroOneKnapsackProblemSmallItems
Source pub struct ZeroOneKnapsackProblemSmallItems {
a: Vec<(i64, i64)>,
b: Vec<(i64, i64)>,
}
crates/aizu_online_judge/src/dpl/dpl_1_h.rs (
line 8)
5pub fn dpl_1_h(reader: impl Read, writer: impl Write) {
6 prepare_io!(reader, writer);
7 sc!(n, w: i64, vw: [(i64, i64); iter n]);
8 let mut knapsack = ZeroOneKnapsackProblemSmallItems::new();
9 knapsack.extend(vw);
10 pp!(knapsack.solve(w));
11}
crates/competitive/src/combinatorial_optimization/knapsack_problem.rs (
line 253)
248 pub fn extend<I>(&mut self, iter: I)
249 where
250 I: IntoIterator<Item = (i64, i64)>,
251 {
252 for (value, weight) in iter.into_iter() {
253 self.insert(value, weight);
254 }
255 }
crates/aizu_online_judge/src/dpl/dpl_1_h.rs (
line 9)
5pub fn dpl_1_h(reader: impl Read, writer: impl Write) {
6 prepare_io!(reader, writer);
7 sc!(n, w: i64, vw: [(i64, i64); iter n]);
8 let mut knapsack = ZeroOneKnapsackProblemSmallItems::new();
9 knapsack.extend(vw);
10 pp!(knapsack.solve(w));
11}
crates/aizu_online_judge/src/dpl/dpl_1_h.rs (
line 10)
5pub fn dpl_1_h(reader: impl Read, writer: impl Write) {
6 prepare_io!(reader, writer);
7 sc!(n, w: i64, vw: [(i64, i64); iter n]);
8 let mut knapsack = ZeroOneKnapsackProblemSmallItems::new();
9 knapsack.extend(vw);
10 pp!(knapsack.solve(w));
11}
Performs copy-assignment from
source.
Read more
Formats the value using the given formatter.
Read more
Returns the “default value” for a type.
Read more
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
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.