diff --git a/cargo-atcoder-1.70.0/contests/abc344/Cargo.lock b/cargo-atcoder-1.70.0/contests/abc344/Cargo.lock new file mode 100644 index 00000000..dbdec361 --- /dev/null +++ b/cargo-atcoder-1.70.0/contests/abc344/Cargo.lock @@ -0,0 +1,168 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "abc344" +version = "0.1.0" +dependencies = [ + "ac-library-rs", + "num", + "proconio", + "superslice", +] + +[[package]] +name = "ac-library-rs" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e1ead7b72f44698f97266946c0576d00c9e2010858f5aba47aa4660177ef73" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "num" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "proc-macro2" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proconio" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c333be3af2936f8e810300bc74fe4d0cc168ebc04ab02a28c5b1060fa1bd59" +dependencies = [ + "lazy_static", + "proconio-derive", +] + +[[package]] +name = "proconio-derive" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bccfa078f1a3db6563793531989799a2201d9bdf609f48dd82620b443fbcd409" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "superslice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab16ced94dbd8a46c82fd81e3ed9a8727dac2977ea869d217bcc4ea1f122e81f" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/cargo-atcoder-1.70.0/contests/abc344/Cargo.toml b/cargo-atcoder-1.70.0/contests/abc344/Cargo.toml new file mode 100644 index 00000000..d2acd5c3 --- /dev/null +++ b/cargo-atcoder-1.70.0/contests/abc344/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "abc344" +version = "0.1.0" +edition = "2021" + +# dependencies added to new project +[dependencies] +ac-library-rs = "=0.1.1" +num = "=0.4.0" +proconio = { version = "=0.4.3", features = ["derive"] } +superslice = "=1.0.0" + +[profile.release] +lto = true +panic = 'abort' diff --git a/cargo-atcoder-1.70.0/contests/abc344/rust-toolchain b/cargo-atcoder-1.70.0/contests/abc344/rust-toolchain new file mode 100644 index 00000000..9006c0b4 --- /dev/null +++ b/cargo-atcoder-1.70.0/contests/abc344/rust-toolchain @@ -0,0 +1 @@ +1.70.0 \ No newline at end of file diff --git a/cargo-atcoder-1.70.0/contests/abc344/src/bin/a.rs b/cargo-atcoder-1.70.0/contests/abc344/src/bin/a.rs new file mode 100644 index 00000000..18589f83 --- /dev/null +++ b/cargo-atcoder-1.70.0/contests/abc344/src/bin/a.rs @@ -0,0 +1,26 @@ +use proconio::{input, marker::Chars}; + +fn main() { + input! { + s: Chars, + }; + let mut in_pipe = false; + let mut ans = vec![]; + for c in s { + if !in_pipe { + if c == '|' { + in_pipe = true; + } else { + ans.push(c); + } + } else { + if c == '|' { + in_pipe = false; + } else { + // do nothing + } + } + } + let ans = ans.into_iter().collect::(); + println!("{}", ans); +} diff --git a/cargo-atcoder-1.70.0/contests/abc344/src/bin/b.rs b/cargo-atcoder-1.70.0/contests/abc344/src/bin/b.rs new file mode 100644 index 00000000..afdb89e2 --- /dev/null +++ b/cargo-atcoder-1.70.0/contests/abc344/src/bin/b.rs @@ -0,0 +1,19 @@ +use proconio::input; + +fn main() { + let mut ans = vec![]; + loop { + input! { + a_i: usize + } + + ans.push(a_i); + if a_i == 0 { + break; + } + } + ans.reverse(); + for a in ans { + println!("{}", a); + } +} diff --git a/cargo-atcoder-1.70.0/contests/abc344/src/bin/c.rs b/cargo-atcoder-1.70.0/contests/abc344/src/bin/c.rs new file mode 100644 index 00000000..85283592 --- /dev/null +++ b/cargo-atcoder-1.70.0/contests/abc344/src/bin/c.rs @@ -0,0 +1,29 @@ +use std::collections::HashSet; + +use proconio::input; + +fn main() { + input! { + n: usize, + a: [usize; n], + m: usize, + b: [usize; m], + l: usize, + c: [usize; l], + q: usize, + x: [usize; q], + }; + + let mut set = HashSet::new(); + for a_i in a.iter().copied() { + for b_i in b.iter().copied() { + for c_i in c.iter().copied() { + set.insert(a_i + b_i + c_i); + } + } + } + for x_i in x { + let ans = set.contains(&x_i); + println!("{}", if ans { "Yes" } else { "No" }); + } +} diff --git a/cargo-atcoder-1.70.0/contests/abc344/src/bin/d.rs b/cargo-atcoder-1.70.0/contests/abc344/src/bin/d.rs new file mode 100644 index 00000000..d4b3b734 --- /dev/null +++ b/cargo-atcoder-1.70.0/contests/abc344/src/bin/d.rs @@ -0,0 +1,41 @@ +use std::collections::BTreeMap; + +use proconio::{input, marker::Chars}; + +fn main() { + input! { + t: Chars, + n: usize, + }; + + let mut s = vec![]; + for _ in 0..n { + input! { + a_i: usize, + s_i: [Chars; a_i], + } + s.push(s_i); + } + + let mut map = BTreeMap::new(); + map.insert(0_usize, 0_usize); + for s_i in s { + let mut next = map.clone(); + for (x, min_x) in map { + for s_ij in s_i.iter() { + if x + s_ij.len() > t.len() { + continue; + } + if s_ij == &t[x..x + s_ij.len()] { + let entry = next.entry(x + s_ij.len()).or_insert(min_x + 1); + *entry = (*entry).min(min_x + 1); + } + } + } + map = next; + } + match map.get(&t.len()) { + Some(x) => println!("{}", x), + None => println!("-1"), + } +} diff --git a/cargo-atcoder-1.70.0/contests/abc344/src/bin/e.rs b/cargo-atcoder-1.70.0/contests/abc344/src/bin/e.rs new file mode 100644 index 00000000..5515bee5 --- /dev/null +++ b/cargo-atcoder-1.70.0/contests/abc344/src/bin/e.rs @@ -0,0 +1,81 @@ +use std::collections::HashMap; + +use proconio::input; + +fn main() { + input! { + n: usize, + a: [usize; n], + q: usize, + }; + + let mut query = vec![]; + for _ in 0..q { + input! { + t: usize, + } + match t { + 1 => { + input! { + x: usize, + y: usize, + } + query.push((t, x, y)); + } + 2 => { + input! { + x: usize, + } + query.push((t, x, 0)); + } + _ => unreachable!(), + } + } + + let mut next = HashMap::new(); + let mut prev = HashMap::new(); + for i in 0..n - 1 { + let a_i = a[i]; + let a_j = a[i + 1]; + next.entry(a_i).or_insert(a_j); + prev.entry(a_j).or_insert(a_i); + } + + let head = 0_usize; + let tail = 1 << 60_usize; + next.insert(head, a[0]); + prev.insert(a[0], head); + next.insert(a[n - 1], tail); + prev.insert(tail, a[n - 1]); + + for (t, x, y) in query { + match t { + 1 => { + // x -> next_x + // => x -> y -> next_x + let next_x = *next.get(&x).unwrap(); + next.insert(x, y); + next.insert(y, next_x); + prev.insert(y, x); + prev.insert(next_x, y); + } + 2 => { + // prev_x -> x -> next_x + // => prev_x -> next_x + let prev_x = *prev.get(&x).unwrap(); + let next_x = *next.get(&x).unwrap(); + next.insert(prev_x, next_x); + prev.insert(next_x, prev_x); + next.remove(&x); + prev.remove(&x); + } + _ => unreachable!(), + } + } + + let mut cur = next[&head]; + while cur != tail { + println!("{}", cur); + cur = next[&cur]; + } +} diff --git a/cargo-atcoder-1.70.0/contests/abc344/src/bin/f.rs b/cargo-atcoder-1.70.0/contests/abc344/src/bin/f.rs new file mode 100644 index 00000000..2a9506c8 --- /dev/null +++ b/cargo-atcoder-1.70.0/contests/abc344/src/bin/f.rs @@ -0,0 +1,10 @@ +use proconio::{input, marker::Usize1}; + +fn main() { + input! { + n: usize, + a: [Usize1; n], + }; + let ans = n - a.len(); + println!("{}", ans); +} diff --git a/cargo-atcoder-1.70.0/contests/abc344/src/bin/g.rs b/cargo-atcoder-1.70.0/contests/abc344/src/bin/g.rs new file mode 100644 index 00000000..2a9506c8 --- /dev/null +++ b/cargo-atcoder-1.70.0/contests/abc344/src/bin/g.rs @@ -0,0 +1,10 @@ +use proconio::{input, marker::Usize1}; + +fn main() { + input! { + n: usize, + a: [Usize1; n], + }; + let ans = n - a.len(); + println!("{}", ans); +}