Skip to content

Commit

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

fn main() {
input! {
s: usize,
t: usize,
x: usize,
};
let mut i = s;
while i != t {
if i == x {
println!("Yes");
return;
}
i += 1;
i %= 24;
}
println!("No");
}
17 changes: 17 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc228/src/bin/b.rs
@@ -0,0 +1,17 @@
use proconio::{input, marker::Usize1};

fn main() {
input! {
n: usize,
x: Usize1,
a: [Usize1; n],
};
let mut visited = vec![false; n];
let mut i = x;
while !visited[i] {
visited[i] = true;
i = a[i];
}
let ans = visited.into_iter().filter(|b| *b).count();
println!("{}", ans);
}
26 changes: 26 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc228/src/bin/c.rs
@@ -0,0 +1,26 @@
use proconio::input;
use superslice::Ext;

fn main() {
input! {
n: usize,
k: usize,
p: [[usize; 3]; n],
};
let mut is = p
.into_iter()
.map(|p_i| p_i.into_iter().sum::<usize>())
.enumerate()
.collect::<Vec<(usize, usize)>>();
is.sort_by_key(|(_, s)| *s);

let mut ans = vec![false; n];
for (i, s) in is.iter().copied() {
let j = is.lower_bound_by_key(&(s + 300 + 1), |(_, s)| *s);
ans[i] = n + 1 - j <= k;
}

for a in ans {
println!("{}", if a { "Yes" } else { "No" });
}
}
10 changes: 10 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc228/src/bin/d.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/abc228/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/abc228/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/abc228/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/abc228/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 8dfd630

Please sign in to comment.