結果

問題 No.3324 ハイライト動画
コンテスト
ユーザー The_Bouningeeeen
提出日時 2025-11-01 16:19:50
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 260 ms / 2,000 ms
コード長 566 bytes
コンパイル時間 22,083 ms
コンパイル使用メモリ 397,840 KB
実行使用メモリ 7,936 KB
最終ジャッジ日時 2025-11-01 16:20:17
合計ジャッジ時間 14,795 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::input;

fn main() {
    input! {
        _n: usize,
        m: usize,
        a: [usize; m],
    }

    let mut seq_count = 1;
    let mut seq_start = a[0];
    let mut ans = vec![];
    for i in 1..m {
        if a[i] == a[i - 1] + 1 {
            seq_count += 1;
        } else {
            ans.push((seq_start, seq_count));
            seq_count = 1;
            seq_start = a[i];
        }
    }
    ans.push((seq_start, seq_count));

    println!("{}", ans.len());
    for (start, count) in ans {
        println!("{} {}", start, count);
    }
}
0