Skip to content

Commit

Permalink
abc219 a, b, c, d
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Oct 4, 2023
1 parent d1ca38f commit 0b88bb2
Show file tree
Hide file tree
Showing 11 changed files with 321 additions and 0 deletions.
169 changes: 169 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc219/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/abc219/Cargo.toml
@@ -0,0 +1,15 @@
[package]
name = "abc219"
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/abc219/rust-toolchain
@@ -0,0 +1 @@
1.70.0
17 changes: 17 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc219/src/bin/a.rs
@@ -0,0 +1,17 @@
use proconio::input;

fn main() {
input! {
x: usize,
}
let ans = if (0..40).contains(&x) {
format!("{}", 40 - x)
} else if (40..70).contains(&x) {
format!("{}", 70 - x)
} else if (70..90).contains(&x) {
format!("{}", 90 - x)
} else {
"expert".to_string()
};
println!("{}", ans);
}
14 changes: 14 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc219/src/bin/b.rs
@@ -0,0 +1,14 @@
use proconio::{input, marker::Chars};

fn main() {
input! {
s: [String; 3],
t: Chars,
}

for t_i in t {
let index = (t_i as u8 - b'1') as usize;
print!("{}", s[index]);
}
println!();
}
23 changes: 23 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc219/src/bin/c.rs
@@ -0,0 +1,23 @@
use std::collections::BTreeMap;

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

fn main() {
input! {
x: Chars,
n: usize,
s: [String; n],
};
let mut map = BTreeMap::new();
for s_i in s {
let t_i = s_i
.chars()
.map(|c| x.iter().position(|c_j| c_j == &c).unwrap())
.collect::<Vec<usize>>();
map.insert(t_i, s_i);
}

for (_, v) in map {
println!("{}", v);
}
}
42 changes: 42 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc219/src/bin/d.rs
@@ -0,0 +1,42 @@
use proconio::input;

macro_rules! chmin {
($min_v: expr, $v: expr) => {
if $v < $min_v {
$min_v = $v;
true
} else {
false
}
};
}

fn main() {
input! {
n: usize,
x: usize,
y: usize,
ab: [(usize, usize); n],
}

let inf = 1_usize << 60;
let mut dp = vec![vec![inf; y + 1]; x + 1];
dp[0][0] = 0;
for (a, b) in ab {
let mut next = vec![vec![inf; y + 1]; x + 1];
for i in 0..=x {
for j in 0..=y {
chmin!(next[i][j], dp[i][j]);
chmin!(next[(i + a).min(x)][(j + b).min(y)], dp[i][j] + 1);
}
}
dp = next;
}

let ans = dp[x][y];
if ans == inf {
println!("-1");
} else {
println!("{}", ans);
}
}
10 changes: 10 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc219/src/bin/e.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);
}
10 changes: 10 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc219/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);
}
10 changes: 10 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc219/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);
}
10 changes: 10 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc219/src/bin/h.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);
}

0 comments on commit 0b88bb2

Please sign in to comment.