結果
| 問題 |
No.3261 yiwiy9 → yiwiY9
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-06 13:53:03 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 1,029 bytes |
| コンパイル時間 | 13,846 ms |
| コンパイル使用メモリ | 377,528 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-09-06 13:53:27 |
| 合計ジャッジ時間 | 14,501 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 29 |
ソースコード
use proconio::{input, marker::Chars};
use std::collections::HashSet;
fn main() {
input! {
h: usize,
w: usize,
mut s: [Chars; h],
}
let mut used_y = HashSet::new();
let mut used_9 = HashSet::new();
for i in 0..h {
for j in 1..w - 1 {
if s[i][j] == 'y' && !used_y.contains(&(i, j)) {
if s[i][j - 1] == '9' && !used_9.contains(&(i, j - 1)) {
s[i][j] = 'Y';
used_y.insert((i, j));
used_y.insert((i, j + 4));
used_9.insert((i, j - 1));
}
if s[i][j + 1] == '9' && !used_9.contains(&(i, j + 1)) {
s[i][j] = 'Y';
used_y.insert((i, j));
used_9.insert((i, j + 1));
}
}
}
}
println!(
"{}",
s.iter()
.map(|s_i| s_i.iter().collect::<String>())
.collect::<Vec<String>>()
.join("\n")
);
}