Skip to content

Commit

Permalink
adt_easy_20240307_3 a, b, c, d, e
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Mar 7, 2024
1 parent 24f2884 commit ef1ece2
Show file tree
Hide file tree
Showing 8 changed files with 272 additions and 0 deletions.
168 changes: 168 additions & 0 deletions cargo-atcoder-1.70.0/contests/adt_easy_20240307_3/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions cargo-atcoder-1.70.0/contests/adt_easy_20240307_3/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "adt_easy_20240307_3"
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'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.70.0
13 changes: 13 additions & 0 deletions cargo-atcoder-1.70.0/contests/adt_easy_20240307_3/src/bin/a.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use proconio::input;

fn main() {
input! {
a: usize,
b: usize,
c: usize,
}
let mut abc = vec![a, b, c];
abc.sort();
let ans = abc[1] == b;
println!("{}", if ans { "Yes" } else { "No" });
}
15 changes: 15 additions & 0 deletions cargo-atcoder-1.70.0/contests/adt_easy_20240307_3/src/bin/b.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use proconio::{input, marker::Chars};

fn main() {
input! {
s: Chars,
};
for i in (2..=16).step_by(2) {
let i = i - 1;
if s[i] != '0' {
println!("No");
return;
}
}
println!("Yes");
}
17 changes: 17 additions & 0 deletions cargo-atcoder-1.70.0/contests/adt_easy_20240307_3/src/bin/c.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use proconio::{input, marker::Chars};

fn main() {
input! {
mut a: Chars,
mut b: Chars,
};
a.reverse();
b.reverse();
for i in 0..a.len().min(b.len()) {
if a[i] as u8 - b'0' + b[i] as u8 - b'0' >= 10 {
println!("Hard");
return;
}
}
println!("Easy");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use proconio::input;

fn main() {
input! {
n: usize,
};
let ans = n.trailing_zeros();
println!("{}", ans);
}
34 changes: 34 additions & 0 deletions cargo-atcoder-1.70.0/contests/adt_easy_20240307_3/src/bin/e.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
use proconio::input;

fn dfs(edges: &[Vec<usize>], depth: &mut Vec<usize>, u: usize, p: usize, l: usize) {
depth[u] = l;
for v in edges[u].iter().copied() {
if v == p {
continue;
}
dfs(edges, depth, v, u, l + 1);
}
}

fn main() {
input! {
n: usize,
a: [usize; n],
};

let mut edges = vec![vec![]; 4 * n];
for (i, a_i) in a.iter().copied().enumerate() {
let i = i + 1;
edges[a_i].push(2 * i);
edges[2 * i].push(a_i);
edges[a_i].push(2 * i + 1);
edges[2 * i + 1].push(a_i);
}

let mut depth = vec![0; 4 * n];
dfs(&edges, &mut depth, 1, 1, 0);

for k in 1..=2 * n + 1 {
println!("{}", depth[k]);
}
}

0 comments on commit ef1ece2

Please sign in to comment.