結果

問題 No.3261 yiwiy9 → yiwiY9
ユーザー yiwiy9
提出日時 2025-09-06 13:47:16
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 820 bytes
コンパイル時間 16,425 ms
コンパイル使用メモリ 401,800 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-06 13:47:35
合計ジャッジ時間 15,044 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::{input, marker::Chars};
use std::collections::HashSet;

fn main() {
    input! {
        h: usize,
        w: usize,
        mut s: [Chars; h],
    }

    let mut used = HashSet::new();
    for i in 0..h {
        for j in 1..w - 1 {
            if s[i][j] == 'y' {
                if s[i][j - 1] == '9' && !used.contains(&(i, j - 1)) {
                    s[i][j] = 'Y';
                    used.insert((i, j - 1));
                }
                if s[i][j + 1] == '9' && !used.contains(&(i, j + 1)) {
                    s[i][j] = 'Y';
                    used.insert((i, j + 1));
                }
            }
        }
    }

    println!(
        "{}",
        s.iter()
            .map(|s_i| s_i.iter().collect::<String>())
            .collect::<Vec<String>>()
            .join("\n")
    );
}
0