結果
| 問題 |
No.930 数列圧縮
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-03 04:49:42 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 755 bytes |
| コンパイル時間 | 13,224 ms |
| コンパイル使用メモリ | 396,344 KB |
| 実行使用メモリ | 9,600 KB |
| 最終ジャッジ日時 | 2024-07-02 12:33:39 |
| 合計ジャッジ時間 | 17,039 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 21 WA * 3 |
ソースコード
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(" "));
}