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
10 changed files
with
361 additions
and
0 deletions.
There are no files selected for viewing
169 changes: 169 additions & 0 deletions
169
cargo-atcoder-1.70.0/contests/past202212-open/abc333/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/past202212-open/abc333/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 = "abc333" | ||
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/past202212-open/abc333/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 |
9 changes: 9 additions & 0 deletions
9
cargo-atcoder-1.70.0/contests/past202212-open/abc333/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,9 @@ | ||
use proconio::input; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
}; | ||
let ans = n.to_string().repeat(n); | ||
println!("{}", ans); | ||
} |
33 changes: 33 additions & 0 deletions
33
cargo-atcoder-1.70.0/contests/past202212-open/abc333/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,33 @@ | ||
use std::collections::HashSet; | ||
|
||
use proconio::{input, marker::Chars}; | ||
|
||
fn main() { | ||
input! { | ||
mut s: Chars, | ||
mut t: Chars, | ||
}; | ||
if s[0] > s[1] { | ||
s.swap(0, 1); | ||
} | ||
if t[0] > t[1] { | ||
t.swap(0, 1); | ||
} | ||
|
||
let mut set1 = HashSet::new(); | ||
set1.insert("AB".chars().collect::<Vec<char>>()); | ||
set1.insert("AE".chars().collect::<Vec<char>>()); | ||
set1.insert("BC".chars().collect::<Vec<char>>()); | ||
set1.insert("CD".chars().collect::<Vec<char>>()); | ||
set1.insert("DE".chars().collect::<Vec<char>>()); | ||
|
||
let mut set2 = HashSet::new(); | ||
set2.insert("AC".chars().collect::<Vec<char>>()); | ||
set2.insert("AD".chars().collect::<Vec<char>>()); | ||
set2.insert("BD".chars().collect::<Vec<char>>()); | ||
set2.insert("BE".chars().collect::<Vec<char>>()); | ||
set2.insert("CE".chars().collect::<Vec<char>>()); | ||
|
||
let ans = (set1.contains(&s) && set1.contains(&t)) || (set2.contains(&s) && set2.contains(&t)); | ||
println!("{}", if ans { "Yes" } else { "No" }); | ||
} |
32 changes: 32 additions & 0 deletions
32
cargo-atcoder-1.70.0/contests/past202212-open/abc333/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,32 @@ | ||
use std::collections::HashSet; | ||
|
||
use proconio::{input, marker::Usize1}; | ||
|
||
fn main() { | ||
input! { | ||
n: Usize1, | ||
}; | ||
|
||
let mut rep = vec![]; | ||
let mut x = 1; | ||
rep.push(x); | ||
for _ in 0..14 { | ||
x *= 10; | ||
x += 1; | ||
rep.push(x); | ||
} | ||
|
||
let mut set = HashSet::new(); | ||
for i in rep.iter().copied() { | ||
for j in rep.iter().copied() { | ||
for k in rep.iter().copied() { | ||
set.insert(i + j + k); | ||
} | ||
} | ||
} | ||
|
||
let mut set = set.iter().copied().collect::<Vec<usize>>(); | ||
set.sort(); | ||
let ans = set[n]; | ||
println!("{}", ans); | ||
} |
41 changes: 41 additions & 0 deletions
41
cargo-atcoder-1.70.0/contests/past202212-open/abc333/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,41 @@ | ||
use proconio::{input, marker::Usize1}; | ||
|
||
fn dfs(size: &mut Vec<usize>, edges: &Vec<Vec<usize>>, u: usize, p: usize) { | ||
for v in edges[u].iter().copied() { | ||
if v == p { | ||
continue; | ||
} | ||
dfs(size, edges, v, u); | ||
size[u] += size[v]; | ||
} | ||
size[u] += 1; | ||
} | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
uv: [(Usize1, Usize1); n - 1], | ||
}; | ||
|
||
let mut edges = vec![vec![]; n]; | ||
for (u, v) in uv { | ||
edges[u].push(v); | ||
edges[v].push(u); | ||
} | ||
|
||
if edges[0].len() == 1 { | ||
println!("1"); | ||
return; | ||
} | ||
|
||
let mut size = vec![0; n]; | ||
dfs(&mut size, &edges, 0, 0); | ||
|
||
let mut max = 0; | ||
for v in edges[0].iter().copied() { | ||
max = max.max(size[v]); | ||
} | ||
|
||
let ans = n - max; | ||
println!("{}", ans); | ||
} |
41 changes: 41 additions & 0 deletions
41
cargo-atcoder-1.70.0/contests/past202212-open/abc333/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,41 @@ | ||
use proconio::{input, marker::Usize1}; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
tx: [(usize, Usize1); n], | ||
}; | ||
let mut need_max = 0_usize; | ||
let mut need_sum = 0_usize; | ||
let mut need = vec![0; n]; | ||
let mut ans = vec![]; | ||
for (t, x) in tx.iter().copied().rev() { | ||
match t { | ||
1 => { | ||
if need[x] > 0 { | ||
need[x] -= 1; | ||
need_sum -= 1; | ||
ans.push(1); | ||
} else { | ||
ans.push(0); | ||
} | ||
} | ||
2 => { | ||
need[x] += 1; | ||
need_sum += 1; | ||
need_max = need_max.max(need_sum); | ||
} | ||
_ => unreachable!(), | ||
} | ||
} | ||
if !need.iter().all(|&x| x == 0) { | ||
println!("-1"); | ||
return; | ||
} | ||
|
||
ans.reverse(); | ||
println!("{}", need_max); | ||
for a in ans { | ||
println!("{}", a); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
cargo-atcoder-1.70.0/contests/past202212-open/abc333/src/bin/f.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,10 @@ | ||
use proconio::{input, marker::Usize1}; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
a: [Usize1; n], | ||
}; | ||
let ans = n - a.len(); | ||
println!("{}", ans); | ||
} |
10 changes: 10 additions & 0 deletions
10
cargo-atcoder-1.70.0/contests/past202212-open/abc333/src/bin/g.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,10 @@ | ||
use proconio::{input, marker::Usize1}; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
a: [Usize1; n], | ||
}; | ||
let ans = n - a.len(); | ||
println!("{}", ans); | ||
} |