Skip to content

Commit

Permalink
abc014
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Dec 28, 2020
1 parent cfc5223 commit 3b4bccf
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 0 deletions.
77 changes: 77 additions & 0 deletions abc014/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions abc014/Cargo.toml
@@ -0,0 +1,14 @@
[package]
name = "abc014"
version = "0.1.0"
authors = ["bouzuya <m@bouzuya.net>"]
edition = "2018"

# dependencies added to new project
[dependencies]
proconio = { version = "=0.3.6", features = ["derive"] }
superslice = "=1.0.0"

[profile.release]
lto = true
panic = 'abort'
1 change: 1 addition & 0 deletions abc014/rust-toolchain
@@ -0,0 +1 @@
1.42.0
11 changes: 11 additions & 0 deletions abc014/src/bin/a.rs
@@ -0,0 +1,11 @@
use proconio::input;

fn main() {
input! {
a: i64,
b: i64,
};
let r = a % b;
let ans = if r == 0 { 0 } else { b - r };
println!("{}", ans);
}
17 changes: 17 additions & 0 deletions abc014/src/bin/b.rs
@@ -0,0 +1,17 @@
use proconio::input;

fn main() {
input! {
n: usize,
x: usize,
a: [i64; n],
};
let mut sum = 0;
for i in 0..n {
if (x >> i) & 1 == 1 {
sum += a[i];
}
}
let ans = sum;
println!("{}", ans);
}
23 changes: 23 additions & 0 deletions abc014/src/bin/c.rs
@@ -0,0 +1,23 @@
use proconio::input;
use std::cmp::max;

fn main() {
input! {
n: usize,
ab: [(usize, usize); n],
};
let mut c = vec![0; 1_000_001 + 1];
for (a_i, b_i) in ab {
c[a_i] += 1;
c[b_i + 1] -= 1;
}
let mut max_x = 0;
let mut x = 0;
for &c_i in c.iter() {
x += c_i;
max_x = max(max_x, x);
}

let ans = max_x;
println!("{}", ans);
}
13 changes: 13 additions & 0 deletions abc014/src/bin/d.rs
@@ -0,0 +1,13 @@
use proconio::input;
use proconio::marker::Usize1;

fn main() {
// おそらく LCA だが解く気力がない。
todo!();
input! {
n: usize,
a: [Usize1; n],
};
let ans = n - a.len();
println!("{}", ans);
}

0 comments on commit 3b4bccf

Please sign in to comment.