結果

問題 No.3526 Anti SKG
コンテスト
ユーザー urectanc
提出日時 2026-05-04 21:27:03
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 515 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,769 ms
コンパイル使用メモリ 201,044 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-05-04 21:27:18
合計ジャッジ時間 5,387 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use proconio::{input, marker::Chars};

fn main() {
    input! {
        mut t: Chars,
    }

    let n = t.len();
    for i in 0..n {
        if t[i] == '.' {
            if i >= 2 && t[i - 2] == 'S' && t[i - 1] == 'K' {
                t[i] = 'K';
            } else {
                t[i] = 'G';
            }
        }
    }

    let ans = t.windows(3).all(|w| w != &['S', 'K', 'G']);
    println!("{}", if ans { "Yes" } else { "No" });
    if ans {
        println!("{}", t.iter().collect::<String>());
    }
}
0