結果

問題 No.930 数列圧縮
ユーザー phspls
提出日時 2023-01-21 02:55:16
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 626 bytes
コンパイル時間 12,804 ms
コンパイル使用メモリ 404,496 KB
実行使用メモリ 10,084 KB
最終ジャッジ日時 2024-06-23 14:17:58
合計ジャッジ時間 15,531 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let n: usize = n.trim().parse().unwrap();
    let mut a = String::new();
    std::io::stdin().read_line(&mut a).ok();
    let a: Vec<usize> = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();

    if a[0] > a[n-1] {
        println!("No");
        return;
    }
    let mut result = (1..a[0]).collect::<Vec<_>>();
    for i in 1..n {
        if a[0] < a[i] {
            result.push(a[i]);
        }
    }
    println!("Yes");
    println!("{}", result.iter().map(|v| v.to_string()).collect::<Vec<_>>().join(" "));
}
0