結果
| 問題 |
No.490 yukiソート
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-22 12:42:54 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 2,000 ms |
| コード長 | 646 bytes |
| コンパイル時間 | 12,441 ms |
| コンパイル使用メモリ | 402,244 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-09 15:58:19 |
| 合計ジャッジ時間 | 14,149 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 34 |
ソースコード
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 mut a: Vec<usize> = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
for i in 1..2*n-3 {
for p in 0..i {
let q: usize = i - p;
if p >= q { break; }
if p >= n || q >= n { continue; }
if a[p] > a[q] {
a.swap(p, q);
}
}
}
println!("{}", a.iter().map(|i| i.to_string()).collect::<Vec<String>>().join(" "));
}