結果
| 問題 |
No.1434 Make Maze
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-19 23:10:42 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,304 bytes |
| コンパイル時間 | 12,997 ms |
| コンパイル使用メモリ | 385,348 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-19 01:10:27 |
| 合計ジャッジ時間 | 17,035 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 WA * 23 |
ソースコード
use std::io::*;
fn main() {
let mut s: String = String::new();
std::io::stdin().read_to_string(&mut s).ok();
let mut itr = s.trim().split_whitespace();
let h: usize = itr.next().unwrap().parse().unwrap();
let w: usize = itr.next().unwrap().parse().unwrap();
let x: usize = itr.next().unwrap().parse().unwrap();
let mn = h + w - 2;
let mx = (h + 1) / 2 * (w - 1) + h - 1;
// println!("{} {}", mn, mx);
if mn <= x && x <= mx && (mx - x) % 4 == 0 {
let mut g = vec![vec!['.'; w]; h];
for i in 0..h {
if i % 2 == 1 {
for j in 0..w {
g[i][j] = '#';
}
}
}
let mut dec = (mx - x) / 4;
for i in 0..h {
if (i + 1) % 4 == 0 {
let dec_max = w / 2;
if dec_max <= dec {
g[i][w - 1] = '.';
dec -= dec_max;
} else {
g[i][dec * 2] = '.';
}
} else if (i + 1) % 2 == 0 {
g[i][w - 1] = '.';
}
}
for i in 0..h {
for j in 0..w {
print!("{}", g[i][j]);
}
println!("");
}
} else {
println!("-1");
}
}