In June 2019, EbTech posted an article How to Compete in Rust. Inspired by that, I'm working on my rust_codeforce_template.
It could be used in such way:
cargo install --git https://github.com/Endle/rust-bundler.git --branch codeforce bundler
git clone https://github.com/Endle/rust_codeforce_template.git --depth=1
main.rs. Most cases, I only need to edit
./run_with_bundle.sh < test.in
- If the result looks good, submit /dev/shm/output.rs to codeforce
This workflow has such advantages IMHO
Template code Move template code out of
main.rs. I could save my time from scrolling up and down. My forked rust-bundler would bundle them into a single file that could be submitted.
Save coding time for IO
I bundled text_io in my
lib.rs. It provides simple reading methods
let i: i32 = read!(); let word: String = read!();
Based on that, I added another function
read_ivec. I think this is the most frequently used function in my template.
I'm new and naive to both Rust and competitive programming. (Well, old and naive for the latter). I'll be so grateful for your comments.
Besides, I recommend rust-algorithms by EbTech. Templates with a high quality:)