12 unstable releases (3 breaking)

0.4.1 Aug 20, 2024
0.4.0 Aug 16, 2024
0.3.4 Aug 14, 2024
0.2.3 Jul 31, 2024
0.1.0 Jul 29, 2024

#1257 in Algorithms

40 downloads per month

MIT license

61KB
1.5K SLoC

cplit

Competitive Programming Library in Rust

This library aims to provide a set of algorithm, data structure and tools for competitive programming.

There are several philosophies behind this library:

  • Simple: The library should be simple and fast to use, as time is precious in competitive programming.
    • Do not overuse Option, Result to provide unnecessary boundary checks (panic is fine).
  • Extensible: Most of algorithms and data structures should not be limited to a specific type.
    • Design genetic traits to allow different types to be used (including potentially user-defined types like matrices).
  • Efficient: The library should be efficient enough for competitive programming problems.
  • Comprehensive: The library should be readable and understandable for educational purposes.
  • Tested: The library should be tested with some problems from online judges to ensure its correctness.
  • Indexed from 1: The library should use 1-based index for most of the algorithms and data structures while leaving the index 0 for buffer manipulation.
    • This is because most of the problem use 1-based index.
    • Index 0 should default be set to ZERO.

Examples

use cplit::scanln;

fn main() {
    let (a, b): (usize, usize);
    scanln!(a, b);
    println!("{}", a + b);
}

No runtime deps