Skip to content

Commit

Permalink
past15-open d
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Dec 8, 2023
1 parent 3498e66 commit d03f9db
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions cargo-atcoder-1.70.0/contests/past15-open/src/bin/d.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
use proconio::{input, marker::Usize1};
use proconio::input;

fn main() {
input! {
n: usize,
a: [Usize1; n],
a: usize,
b: usize,
c: usize,
d: usize,
r: usize,
};
let ans = n - a.len();
println!("{}", ans);

let mut ok = vec![0_i64; a.max(c) + r + r + 1];
for t in 0..=a.max(c) + r {
if t % d == 0 {
let (p, q) = if t < b { (a, a + r) } else { (c, c + r) };
if t < q {
ok[p.max(t)] += 1;
ok[q] -= 1;
}
}
}
for t in 0..a.max(c) + r + r {
ok[t + 1] += ok[t];
}

let ans = ok.iter().skip(c).take(r).all(|&x| x > 0);
println!("{}", if ans { "Yes" } else { "No" });
}

0 comments on commit d03f9db

Please sign in to comment.