結果

問題 No.2773 Wake up Record 1
ユーザー Haniwa
提出日時 2025-10-12 19:42:41
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 519 bytes
コンパイル時間 13,296 ms
コンパイル使用メモリ 397,608 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-12 19:42:56
合計ジャッジ時間 13,427 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `n`
 --> src/main.rs:5:9
  |
5 |         n: usize,
  |         ^ help: if this is intentional, prefix it with an underscore: `_n`
  |
  = note: `#[warn(unused_variables)]` on by default

ソースコード

diff #

use proconio::input;

fn main() {
    input! {
        n: usize,
        s: String,
    }

    let chars: Vec<char> = s.chars().collect();

    let ans: Vec<usize> = chars
        .windows(2)
        .enumerate()
        .filter(|(_, w)| w[0] == 'x' && w[1] == 'o')
        .map(|(i, _)| i + 2)
        .collect();

    if ans.is_empty() {
        println!("0");
    	println!(" ");
    } else {
        println!("{}", ans.len());
        for a in ans {
            print!("{a} ");
        }
        println!();
    }
}
0