Skip to content

Commit

Permalink
k2pc-easy b
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Nov 25, 2021
1 parent 7f05e26 commit 1170017
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions k2pc-easy/src/bin/b.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
use proconio::{input, marker::Usize1};
use proconio::{input, marker::Chars};

fn main() {
input! {
n: usize,
a: [Usize1; n],
mut a: [usize; 10],
c: [Chars; n],
};
let ans = n - a.len();
println!("{}", ans);
let mut xs = vec![0; 7];
let mut cs = vec![0; 7];
for c_i in c.iter() {
for (j, c_ij) in c_i.iter().copied().enumerate() {
match c_ij {
'X' => {
cs[j] += 1;
xs[j] = xs[j].max(cs[j]);
}
'-' => {
cs[j] = 0;
}
_ => unreachable!(),
}
}
}
xs.sort();
a.sort();

let ans = xs.iter().zip(a.iter().skip(3)).all(|(x_i, a_i)| x_i <= a_i);
println!("{}", if ans { "YES" } else { "NO" });
}

0 comments on commit 1170017

Please sign in to comment.