結果

問題 No.930 数列圧縮
ユーザー phsplsphspls
提出日時 2023-02-03 04:49:42
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 755 bytes
コンパイル時間 2,561 ms
コンパイル使用メモリ 149,980 KB
実行使用メモリ 9,592 KB
最終ジャッジ日時 2023-09-15 08:15:06
合計ジャッジ時間 6,154 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 23 ms
7,024 KB
testcase_09 AC 26 ms
8,032 KB
testcase_10 AC 22 ms
6,900 KB
testcase_11 AC 24 ms
7,364 KB
testcase_12 AC 28 ms
8,132 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 18 ms
9,592 KB
testcase_16 AC 19 ms
9,576 KB
testcase_17 AC 33 ms
9,564 KB
testcase_18 AC 32 ms
9,576 KB
testcase_19 AC 33 ms
9,520 KB
testcase_20 AC 32 ms
9,460 KB
testcase_21 AC 32 ms
9,520 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 18 ms
9,528 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 WA -
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!("Mp");
        return;
    }
    println!("Yes");
    let mut orders = (0..n).collect::<Vec<_>>();
    orders.sort_by_key(|&i| a[i]);
    let mut orders = orders.into_iter().take_while(|&v| v > 0).map(|i| a[i]).collect::<Vec<_>>();
    for &v in a.iter().skip(1).filter(|&&v| v > a[0]) {
        orders.push(v);
    }
    println!("{}", orders.into_iter().map(|v| v.to_string()).collect::<Vec<_>>().join(" "));
}
0