結果

問題 No.3261 yiwiy9 → yiwiY9
コンテスト
ユーザー elphe
提出日時 2025-11-20 19:40:16
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 940 bytes
コンパイル時間 12,396 ms
コンパイル使用メモリ 399,716 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-11-20 19:40:32
合計ジャッジ時間 13,641 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use proconio::{fastout, input, marker::Bytes};

#[fastout]
fn main() {
    input! {
        h: usize,
        _w: usize,
        s: [Bytes; h],
    }

    println!("{}", output(solve(s)));
}

fn solve(mut s: Vec<Vec<u8>>) -> Vec<Vec<u8>> {
    for s in &mut s {
        let mut j = 0;
        while j < s.len() && s[j] == b'.' {
            j += 1;
        }
        while j < s.len() {
            match s[j] {
                b'9' => {
                    s[j + 1] = b'Y';
                    j += 6;
                }
                b'y' => {
                    s[j + 4] = b'Y';
                    j += 6;
                }
                _ => (),
            }
            while j < s.len() && s[j] == b'.' {
                j += 1;
            }
        }
    }
    s
}

fn output(ans: Vec<Vec<u8>>) -> String {
    ans.into_iter()
        .map(|x| String::from_utf8(x).unwrap())
        .collect::<Vec<_>>()
        .join("\n")
}
0