Skip to content

Commit

Permalink
abc341 a, b, c, e
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Feb 17, 2024
1 parent 01dca67 commit 7294096
Show file tree
Hide file tree
Showing 10 changed files with 418 additions and 0 deletions.
168 changes: 168 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc341/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/abc341/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "abc341"
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 cargo-atcoder-1.70.0/contests/abc341/rust-toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.70.0
12 changes: 12 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc341/src/bin/a.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use proconio::input;

fn main() {
input! {
n: usize,
};
print!("1");
for _ in 0..n {
print!("01");
}
println!();
}
15 changes: 15 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc341/src/bin/b.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use proconio::input;

fn main() {
input! {
n: usize,
mut a: [usize; n],
st: [(usize, usize); n - 1],
};
for i in 0..n - 1 {
let (s, t) = st[i];
a[i + 1] += a[i] / s * t;
}
let ans = a[n - 1];
println!("{}", ans);
}
53 changes: 53 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc341/src/bin/c.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
use std::collections::HashSet;

use proconio::{input, marker::Chars};

fn main() {
input! {
h: usize,
w: usize,
_n: usize,
t: Chars,
s: [Chars; h],
};

let mut set = HashSet::new();
for i in 0..h {
for j in 0..w {
if s[i][j] == '#' {
continue;
}

let mut ok = true;
let mut cur = (i, j);
for t_i in t.iter().copied() {
let (i, j) = cur;
let (di, dj) = match t_i {
'L' => (0, -1),
'R' => (0, 1),
'U' => (-1, 0),
'D' => (1, 0),
_ => unreachable!(),
};
let (ni, nj) = (i as i64 + di, j as i64 + dj);
if !(0..h as i64).contains(&ni) || !(0..w as i64).contains(&nj) {
ok = false;
break;
}
let (ni, nj) = (ni as usize, nj as usize);
if s[ni][nj] == '#' {
ok = false;
break;
}
cur = (ni, nj);
}

if ok {
set.insert(cur);
}
}
}

let ans = set.len();
println!("{}", ans);
}
10 changes: 10 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc341/src/bin/d.rs
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);
}

0 comments on commit 7294096

Please sign in to comment.