結果

問題 No.3685 ワロングアンサーやんけ!
コンテスト
ユーザー lp_ql
提出日時 2026-07-11 14:04:34
言語 Rust
(1.97.1 + proconio + num + itertools + ACL)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,098 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,270 ms
コンパイル使用メモリ 186,192 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-09-05 12:38:50
合計ジャッジ時間 3,849 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 32
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use itertools::Itertools;
use proconio::{input, marker::Chars};
fn main() {
    input! {
        n: usize,
        m: usize,
        mut s: Chars,
        t: String,
    }
    if t == "Warong" {
        for i in 0..m {
            s[i] = 'A';
        }
        if s.iter().all(|&c| c != 'W') && s.iter().filter(|&&c| c == '?').count() == 1 {
            for i in 0..n {
                if s[i] == '?' {
                    s[i] = 'W';
                }
            }
        }
    }
    // not AAA.. || not any(W)
    if t == "NotWarong" {
        // AAA.., not any(W) 
        if s[..m].iter().all(|&c| c == 'A') {
            for i in m..n {
                if s[i] == '?' {
                    s[i] = 'A';
                }
            }
        }
        // not AAA.., any(W) 
        if s[m..].iter().any(|&c| c == 'W') && s[..m].iter().all(|&c| c != 'W') && s[..m].iter().filter(|&&c| c == '?').count() == 1 {
            for i in 0..m {
                if s[i] == '?' {
                    s[i] = 'W';
                }
            }
        }
    }
    println!("{}", s.iter().join(""));
}
0