#![allow(unused_imports)] use std::cmp::*; use std::collections::*; use std::io::Write; use std::ops::Bound::*; #[allow(unused_macros)] macro_rules! debug { ($($e:expr),*) => { #[cfg(debug_assertions)] $({ let (e, mut err) = (stringify!($e), std::io::stderr()); writeln!(err, "{} = {:?}", e, $e).unwrap() })* }; } fn main() { let v = read_vec::(); let (mut h, mut w, x) = (v[0], v[1], v[2]); let mut swapped = false; if (w - 3) % 4 == 0 && (h - 3) % 4 != 0 { swapped = true; std::mem::swap(&mut h, &mut w); } let mut max_len = (h - 1) * (w + 1) / 2 + (w - 1); let mut reduced = false; if (w - 3) % 4 == 0 { reduced = true; max_len -= 2; } let min_len = h + w - 2; if x < min_len || x > max_len { println!("-1"); return; } if (x - min_len) % 4 != 0 { println!("-1"); return; } debug!(min_len, max_len); let mut used = vec![]; for x in 0..w { if x % 2 == 0 { continue; } if x % 4 == 1 { for y in (0..h - 1).rev() { if y % 2 == 0 { used.push((x, y)); } } } else { for y in 1..h { if y % 2 == 0 { used.push((x, y)); } } } } debug!(used); used.reverse(); let mut added = vec![]; let mut cur = max_len; while cur > x { let (x, y) = used.pop().unwrap(); if x % 4 == 1 { added.push((x, y + 2)); } else { added.push((x, y - 2)); } cur -= 4; } used.append(&mut added); let mut grid = vec![vec!['.'; w]; h]; for (x, y) in used { grid[y][x] = '#'; } for y in 0..h { for x in 0..w { if x % 2 == 1 && y % 2 == 1 { grid[y][x] = '#'; } } } for y in 0..h { for x in 0..w { print!("{}", grid[y][x]); } println!(""); } } fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec() -> Vec { read::() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() }