From fb6173d1aa6ed2a9cb9167abb1bdacf2d873e9b0 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sun, 20 Apr 2025 15:14:14 -0600 Subject: [PATCH 1/4] add gitgud --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 065e37a4..d9355a4d 100644 --- a/README.md +++ b/README.md @@ -13,3 +13,7 @@ - https://github.com/EbTech/rust-algorithms - https://github.com/qitoy/rust-library - https://github.com/stuart0035/procon-lib-rs + +## Our List of Recommended Practice Problems + +[gitgud.cc](https://www.gitgud.cc/) From 0db9ce966d2750e4663ebb2030897aeff4cd252c Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sun, 20 Apr 2025 15:15:16 -0600 Subject: [PATCH 2/4] format --- examples/data_structures/deq_agg.rs | 2 +- examples/data_structures/range_container_handmade.rs | 2 +- examples/helpers/lis_handmade.rs | 2 +- src/graphs/count_paths_per_length.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/data_structures/deq_agg.rs b/examples/data_structures/deq_agg.rs index d1f880bf..3f2d3b6a 100644 --- a/examples/data_structures/deq_agg.rs +++ b/examples/data_structures/deq_agg.rs @@ -2,7 +2,7 @@ use proconio::input; use programming_team_code_rust::data_structures::deq_agg::DeqAgg; -use rand::{thread_rng, Rng}; +use rand::{Rng, thread_rng}; use std::collections::VecDeque; const MOD: u64 = 998_244_353; diff --git a/examples/data_structures/range_container_handmade.rs b/examples/data_structures/range_container_handmade.rs index e26762a7..2603b24c 100644 --- a/examples/data_structures/range_container_handmade.rs +++ b/examples/data_structures/range_container_handmade.rs @@ -1,7 +1,7 @@ // verification-helper: PROBLEM https://onlinejudge.u-aizu.ac.jp/courses/lesson/2/ITP1/all/ITP1_1_A use programming_team_code_rust::data_structures::range_container::RangeContainer; -use rand::{thread_rng, Rng}; +use rand::{Rng, thread_rng}; use std::collections::BTreeMap; fn main() { diff --git a/examples/helpers/lis_handmade.rs b/examples/helpers/lis_handmade.rs index 8815bd89..67d81b8d 100644 --- a/examples/helpers/lis_handmade.rs +++ b/examples/helpers/lis_handmade.rs @@ -1,7 +1,7 @@ // verification-helper: PROBLEM https://onlinejudge.u-aizu.ac.jp/courses/lesson/2/ITP1/all/ITP1_1_A use programming_team_code_rust::helpers::lis::Lis; -use rand::{thread_rng, Rng}; +use rand::{Rng, thread_rng}; fn lis_quadratic(a: &[i32]) -> usize { let n = a.len(); diff --git a/src/graphs/count_paths_per_length.rs b/src/graphs/count_paths_per_length.rs index 8293b18c..f8a7cdc3 100644 --- a/src/graphs/count_paths_per_length.rs +++ b/src/graphs/count_paths_per_length.rs @@ -1,5 +1,5 @@ //! # Count the number of paths of each length in a tree -use crate::graphs::cent_decomp::{cent_decomp, CentDecompDfs}; +use crate::graphs::cent_decomp::{CentDecompDfs, cent_decomp}; use crate::numbers::fft::fft_multiply; fn conv(a: &[u64], b: &[u64]) -> Vec { From e79589b4ff00a8248ad74d33e0648e56abfea389 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sun, 20 Apr 2025 15:16:49 -0600 Subject: [PATCH 3/4] fix --- src/data_structures/deq_agg.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data_structures/deq_agg.rs b/src/data_structures/deq_agg.rs index 6ebd1330..44fb5ac0 100644 --- a/src/data_structures/deq_agg.rs +++ b/src/data_structures/deq_agg.rs @@ -145,7 +145,7 @@ impl T> DeqAgg { if self.le.is_empty() { let mut ary = vec![]; std::mem::swap(&mut ary, &mut self.ri); - self.rebuild((ary.len() + 1) / 2, ary); + self.rebuild(ary.len().div_ceil(2), ary); } self.le.pop().map(|elem| elem.0) } From c83de5b69477f5732af5f2ffe6ef5163e6b97345 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sun, 20 Apr 2025 15:20:53 -0600 Subject: [PATCH 4/4] fix --- examples/graphs/bridges_aizu.rs | 2 +- examples/graphs/cuts_aizu.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/graphs/bridges_aizu.rs b/examples/graphs/bridges_aizu.rs index faf58f11..ac16f174 100644 --- a/examples/graphs/bridges_aizu.rs +++ b/examples/graphs/bridges_aizu.rs @@ -24,7 +24,7 @@ fn main() { let mut all_bridges: Vec<(usize, usize)> = vec![]; - for (i, (mut u, mut v)) in edges.iter_mut().enumerate() { + for (i, &mut (mut u, mut v)) in edges.iter_mut().enumerate() { if is_bridge[i] { if u > v { std::mem::swap(&mut u, &mut v); diff --git a/examples/graphs/cuts_aizu.rs b/examples/graphs/cuts_aizu.rs index 9f4703b7..717ddc46 100644 --- a/examples/graphs/cuts_aizu.rs +++ b/examples/graphs/cuts_aizu.rs @@ -30,7 +30,7 @@ fn main() { let all_cut_nodes = is_cut .iter() .enumerate() - .filter(|(_, &value)| value) + .filter(|&(_, &value)| value) .map(|(index, _)| index) .collect::>();