結果

問題 No.3261 yiwiy9 → yiwiY9
ユーザー sampleuser
提出日時 2025-09-06 21:01:00
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 1,340 bytes
コンパイル時間 14,503 ms
コンパイル使用メモリ 397,296 KB
実行使用メモリ 7,840 KB
最終ジャッジ日時 2025-09-06 21:01:16
合計ジャッジ時間 14,479 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused imports: `HashMap` and `HashSet`
 --> src/main.rs:6:24
  |
6 | use std::collections::{HashMap, HashSet};
  |                        ^^^^^^^  ^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `Usize1`
 --> src/main.rs:9:39
  |
9 | use proconio::{input, marker::{Chars, Usize1}};
  |                                       ^^^^^^

ソースコード

diff #

// #[rustfmt::skip]
// pub mod lib {pub use ac_library::*;pub use itertools::{join, Combinations, Itertools, MultiProduct, Permutations};pub use proconio::{input,marker::{Chars, Usize1}};pub use std::{cmp::*, collections::*, mem::swap};pub use regex::Regex;pub use superslice::Ext;pub use num_traits::{One, ToPrimitive, FromPrimitive, PrimInt};#[macro_export]macro_rules! degg {($($val:expr),+ $(,)?) => {println!("[{}:{}] {}",file!(),line!(),{let mut parts = Vec::new();$(parts.push(format!("{} = {:?}", stringify!($val), &$val));)+parts.join(", ")})}}}

// use lib::*;

use std::collections::{HashMap, HashSet};

// use itertools::Itertools;
use proconio::{input, marker::{Chars, Usize1}};



fn main() {
    input! {
        h: usize,
        w: usize,
        mut s: [Chars; h]
    }
    
    for i in 0..h {
        let nine = s[i].iter().position(|&e| e == '9');
        if nine.is_none() {
            println!("{}", s[i].iter().collect::<String>());
            continue;
        }
        let nine = nine.unwrap();
        if nine == 0 {
            s[i][nine + 1] = 'Y';
        } else {
            if nine == w - 1 || s[i][nine - 1] == 'y' {
                s[i][nine - 1] = 'Y';
            } else {
                s[i][nine + 1] = 'Y';
            }
        }
        println!("{}", s[i].iter().collect::<String>());
    }
}
0