結果
問題 | No.490 yukiソート |
ユーザー |
![]() |
提出日時 | 2019-02-26 14:47:56 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 543 bytes |
コンパイル時間 | 13,815 ms |
コンパイル使用メモリ | 244,008 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-22 05:23:04 |
合計ジャッジ時間 | 13,591 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
package mainimport ("fmt""math")func main() {var n, a int_, _ = fmt.Scan(&n)nums := make([]int, n)for i := range nums {_, _ = fmt.Scan(&a)nums[i] = a}for i := 1; i < 2*n-3; i++ {for p := int(math.Max(0, float64(i-n-1))); p <= n-2; p++ {q := i - pif !(0 <= q && p < q && q <= n-1) {continue}if nums[p] > nums[q] {nums[p], nums[q] = nums[q], nums[p]}}}for i, a := range nums {fmt.Print(a)if i == len(nums)-1 {fmt.Printf("\n")} else {fmt.Printf(" ")}}}