結果
| 問題 | No.82 市松模様 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-02-01 00:36:28 |
| 言語 | Rust (1.93.0 + proconio + num + itertools) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 848 bytes |
| 記録 | |
| コンパイル時間 | 1,433 ms |
| コンパイル使用メモリ | 204,924 KB |
| 実行使用メモリ | 7,976 KB |
| 最終ジャッジ日時 | 2026-02-01 00:36:31 |
| 合計ジャッジ時間 | 2,860 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
ソースコード
fn main() {
let stdin = std::io::read_to_string(std::io::stdin()).unwrap();
let mut stdin = stdin.split_ascii_whitespace();
let w: usize = stdin.next().unwrap().parse().unwrap();
let h: usize = stdin.next().unwrap().parse().unwrap();
let c: char = stdin.next().unwrap().parse().unwrap();
println!("{}", output(solve(w, h, c)));
}
fn solve(w: usize, h: usize, c: char) -> Vec<Vec<u8>> {
(0..h)
.map(|i| {
(0..w)
.map(|j| match ((i & 1) ^ (j & 1) == 1) ^ (c as u8 == b'B') {
true => b'B',
false => b'W',
})
.collect()
})
.collect()
}
fn output(ans: Vec<Vec<u8>>) -> String {
ans.into_iter()
.map(|x| String::from_utf8(x).unwrap())
.collect::<Vec<_>>()
.join("\n")
}