use proconio::{fastout, input, marker::Bytes}; #[fastout] fn main() { input! { _n: usize, w: usize, h: u8, s: Bytes, } println!("{}", output(solve(w, h, s))); } fn solve(w: usize, h: u8, s: Vec) -> Vec> { let mut count_of = vec![0; w]; let mut r = 0; let mut c = 0; for &s in &s { match s { b'o' => r += 1, b'l' => { count_of[c as usize] = r; r = 0; c += 1; } _ => unreachable!(), } } if c < count_of.len() { count_of[c as usize] = r; } (0..h) .map(|r| { count_of .iter() .map(|&c| if c >= (h - r) { b'o' } else { b'x' }) .collect() }) .collect() } fn output(ans: Vec>) -> String { ans.into_iter() .map(|x| String::from_utf8(x).unwrap()) .collect::>() .join("\n") }