結果

問題 No.930 数列圧縮
ユーザー phsplsphspls
提出日時 2023-01-20 01:07:26
言語 Rust
(1.77.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 666 bytes
コンパイル時間 996 ms
コンパイル使用メモリ 145,924 KB
実行使用メモリ 10,108 KB
最終ジャッジ日時 2023-09-04 20:42:03
合計ジャッジ時間 3,569 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 13 ms
7,548 KB
testcase_09 AC 14 ms
8,396 KB
testcase_10 AC 13 ms
7,264 KB
testcase_11 AC 13 ms
7,824 KB
testcase_12 AC 16 ms
8,624 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 18 ms
10,036 KB
testcase_16 AC 18 ms
10,100 KB
testcase_17 AC 19 ms
10,100 KB
testcase_18 AC 18 ms
10,108 KB
testcase_19 AC 18 ms
10,044 KB
testcase_20 AC 19 ms
10,004 KB
testcase_21 AC 19 ms
10,044 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 17 ms
10,032 KB
testcase_24 AC 1 ms
4,384 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

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 = Vec::with_capacity(n-1);
    for i in 1..a[0] {
        result.push(i)
    }
    for &v in a.iter().skip(1).filter(|&&v| v > a[0]) {
        result.push(v);
    }
    println!("Yes");
    println!("{}", result.iter().map(|v| v.to_string()).collect::<Vec<_>>().join(" "));
}
0