-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
272 additions
and
0 deletions.
There are no files selected for viewing
168 changes: 168 additions & 0 deletions
168
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.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
cargo-atcoder-1.70.0/contests/adt_easy_20240307_3/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
1 change: 1 addition & 0 deletions
1
cargo-atcoder-1.70.0/contests/adt_easy_20240307_3/rust-toolchain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.70.0 |
13 changes: 13 additions & 0 deletions
13
cargo-atcoder-1.70.0/contests/adt_easy_20240307_3/src/bin/a.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
15
cargo-atcoder-1.70.0/contests/adt_easy_20240307_3/src/bin/b.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
17
cargo-atcoder-1.70.0/contests/adt_easy_20240307_3/src/bin/c.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} |
9 changes: 9 additions & 0 deletions
9
cargo-atcoder-1.70.0/contests/adt_easy_20240307_3/src/bin/d.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
34
cargo-atcoder-1.70.0/contests/adt_easy_20240307_3/src/bin/e.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); | ||
} | ||
} |