結果

問題 No.490 yukiソート
ユーザー lam6er
提出日時 2025-03-20 20:20:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 336 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 82,788 KB
実行使用メモリ 66,044 KB
最終ジャッジ日時 2025-03-20 20:21:19
合計ジャッジ時間 2,708 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))

for i in range(1, 2 * n - 3):
    p_min = max(0, i - (n - 1))
    p_max = (i - 1) // 2
    for p in range(p_min, p_max + 1):
        q = i - p
        if q >= n or p >= q:
            continue
        if a[p] > a[q]:
            a[p], a[q] = a[q], a[p]

print(' '.join(map(str, a)))
0