結果

問題 No.490 yukiソート
ユーザー
提出日時 2024-05-24 14:35:55
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 14,988 ms
コンパイル使用メモリ 384,948 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-20 19:23:05
合計ジャッジ時間 14,748 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::Read;

fn main() {
	let mut s = String::new();
	std::io::stdin().read_to_string(&mut s).ok();
	let mut n: Vec<u64> =
		s.split_whitespace().skip(1).flat_map(str::parse).collect();
	let l = n.len() - 1;
	for i in 1..l * 2 - 1 {
		for p in 0.max(i.saturating_sub(l))..=i / 2 {
			if n[p] > n[i - p] {
				n.swap(p, i - p);
			}
		}
	}
	println!(
		"{}",
		n.iter()
			.map(|x| x.to_string())
			.collect::<Vec<String>>()
			.join(" ")
	);
}
0