use proconio::{fastout, input}; #[fastout] fn main() { input! { n: usize, m: usize, op: char, b: [u32; m], a: [u32; n], } println!("{}", output(solve(op, b, a))) } fn solve(op: char, b: Vec, a: Vec) -> Vec> { a.into_iter() .map(|a| { b.iter() .map(|&b| match op { '+' => (a + b) as u64, '*' => a as u64 * b as u64, _ => unreachable!(), }) .collect() }) .collect() } fn output(ans: Vec>) -> String { ans.into_iter() .map(|x| { x.into_iter() .map(|x| x.to_string()) .collect::>() .join(" ") }) .collect::>() .join("\n") }