結果

問題 No.490 yukiソート
ユーザー Takuya NoguchiTakuya Noguchi
提出日時 2018-03-14 21:54:50
言語 Ruby
(3.3.0)
結果
AC  
実行時間 843 ms / 2,000 ms
コード長 206 bytes
コンパイル時間 591 ms
コンパイル使用メモリ 11,360 KB
実行使用メモリ 15,568 KB
最終ジャッジ日時 2023-08-19 19:22:53
合計ジャッジ時間 12,331 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
15,136 KB
testcase_01 AC 74 ms
15,136 KB
testcase_02 AC 75 ms
15,136 KB
testcase_03 AC 74 ms
15,152 KB
testcase_04 AC 92 ms
15,080 KB
testcase_05 AC 93 ms
15,404 KB
testcase_06 AC 93 ms
15,392 KB
testcase_07 AC 95 ms
15,456 KB
testcase_08 AC 95 ms
15,264 KB
testcase_09 AC 94 ms
15,128 KB
testcase_10 AC 93 ms
15,292 KB
testcase_11 AC 94 ms
15,392 KB
testcase_12 AC 93 ms
15,168 KB
testcase_13 AC 93 ms
15,176 KB
testcase_14 AC 825 ms
15,388 KB
testcase_15 AC 841 ms
15,268 KB
testcase_16 AC 840 ms
15,532 KB
testcase_17 AC 843 ms
15,388 KB
testcase_18 AC 827 ms
15,520 KB
testcase_19 AC 828 ms
15,536 KB
testcase_20 AC 838 ms
15,396 KB
testcase_21 AC 829 ms
15,520 KB
testcase_22 AC 825 ms
15,264 KB
testcase_23 AC 826 ms
15,568 KB
testcase_24 AC 77 ms
15,296 KB
testcase_25 AC 75 ms
15,144 KB
testcase_26 AC 76 ms
15,048 KB
testcase_27 AC 76 ms
15,236 KB
testcase_28 AC 75 ms
15,240 KB
testcase_29 AC 76 ms
15,144 KB
testcase_30 AC 76 ms
15,152 KB
testcase_31 AC 75 ms
15,176 KB
testcase_32 AC 75 ms
15,284 KB
testcase_33 AC 75 ms
15,260 KB
testcase_34 AC 75 ms
15,164 KB
testcase_35 AC 75 ms
15,292 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
a = gets.split.map(&:to_i)

1.upto(2 * n - 4) do |i|
  n.times do |q|
    next if i < q
    p = i - q
    next if p >= q

    a[p], a[q] = a[q], a[p] if a[p] > a[q]
  end
end

puts a.join(' ')
0