Skip to content

Commit

Permalink
move templates to cargo project
Browse files Browse the repository at this point in the history
  • Loading branch information
optozorax committed Dec 27, 2020
1 parent f8e132f commit e8c7352
Show file tree
Hide file tree
Showing 52 changed files with 1,034 additions and 867 deletions.
25 changes: 9 additions & 16 deletions contests/codeforces/1451/generated/e2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*****************************************************************************
* Generated and tested by: olytest (https://github.com/optozorax/olytest) *
* Author: Ilya Sheprut a.k.a. optozorax *
* Generated at: Mon, 28 Dec 2020 00:52:46 +0700 *
* License: MIT/Apache 2.0 *
*****************************************************************************
*/

#![allow(unused_imports, clippy::many_single_char_names)]
use std::{
collections::BTreeMap,
Expand Down Expand Up @@ -220,22 +228,6 @@ macro_rules! read {
}};
}

trait CountVecTrait {
fn collect_count(self, max: usize) -> Vec<usize>;
}

impl<T: Iterator<Item = K>, K: Into<usize>> CountVecTrait for T {
fn collect_count(self, max: usize) -> Vec<usize> {
let mut result = vec![0; max];
for i in self {
result[i.into()] += 1;
}
result
}
}

// ---------------------------------------------------------------------------

trait FindDuplicatesWithVecBy: Sized {
fn duplicates_with_vec_by<T: Clone, F: Fn(T) -> usize>(self, vec_size: usize, f: F) -> DuplicatesWithVecBy<Self, F, T> where Self: std::iter::Iterator<Item = T>;
}
Expand Down Expand Up @@ -273,6 +265,7 @@ impl<I: Iterator<Item = T>, F: Fn(T) -> usize, T: Clone> Iterator for Duplicates
}
}


enum Get {
Xor,
And,
Expand Down
20 changes: 6 additions & 14 deletions contests/codeforces/1451/src/bin/e2_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,18 @@ pub fn main() {
// ----------------------------- Fast IO ------------------------------ //
let stdout = stdout();
let mut writer = BufWriter::new(stdout.lock());
macro_rules! print { ($($x:tt)*) => { write!(writer, $($x)*).unwrap() }; }
macro_rules! println { ($($x:tt)*) => { writeln!(writer, $($x)*).unwrap() }; }
macro_rules! flush {
($($x:tt)*) => {
writer.flush().unwrap()
};
}
#[rustfmt::skip] macro_rules! flush { ($($x:tt)*) => { writer.flush().unwrap() }; }

let input = stdin();
let mut scanner = Scanner::new(input.lock().bytes().map(|x| x.unwrap()));
#[rustfmt::skip] macro_rules! read { ($t:tt) => { scanner.read::<$t>() }; }
#[rustfmt::skip] macro_rules! readln { ($t:tt) => { scanner.readln::<$t>() }; }
#[rustfmt::skip] macro_rules! byte { () => { scanner.byte() }; }
#[rustfmt::skip] macro_rules! bytes { () => { scanner.bytes() }; }
// -------------------------------------------------------------------- //


let arr = readln!(usize);
println!("{}", arr.len());
flush!();
Expand Down Expand Up @@ -73,11 +71,5 @@ pub fn main() {
// Source: https://github.com/optozorax/olymp/tree/master/templates ----------
//----------------------------------------------------------------------------

use std::{
fmt::{Debug, Display, Formatter},
io::{self, stdin, stdout, BufWriter, Read, Write},
iter::Peekable,
str::FromStr,
};

include!("../../../../../templates/read_print.rs");
include!("../../../../../templates/src/to_include/imports.rs");
include!("../../../../../templates/src/to_include/scanner.rs");
2 changes: 1 addition & 1 deletion contests/codeforces/1451/src/e2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ macro_rules! read {
}};
}

include!("../../../../templates/iterators.rs");
include!("../../../../templates/src/to_include/iterator/duplicate.rs");

enum Get {
Xor,
Expand Down
2 changes: 2 additions & 0 deletions contests/codeforces/1451/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ pub mod b;
pub mod c;
pub mod d;
pub mod e2;


2 changes: 2 additions & 0 deletions templates/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target
Cargo.lock
11 changes: 11 additions & 0 deletions templates/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "templates"
version = "0.1.0"
authors = ["ilya sheprut <optozorax@gmail.com>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rand = "0.7.3"
color-backtrace = "0.5.0"
124 changes: 0 additions & 124 deletions templates/binary_search.rs

This file was deleted.

41 changes: 0 additions & 41 deletions templates/general_math.rs

This file was deleted.

37 changes: 0 additions & 37 deletions templates/imports.rs

This file was deleted.

19 changes: 0 additions & 19 deletions templates/join_display.rs

This file was deleted.

36 changes: 0 additions & 36 deletions templates/median.rs

This file was deleted.

Loading

0 comments on commit e8c7352

Please sign in to comment.