結果

問題 No.14 最小公倍数ソート
ユーザー gew1fw
提出日時 2025-06-12 20:45:18
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 232 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 82,264 KB
実行使用メモリ 260,848 KB
最終ジャッジ日時 2025-06-12 20:45:26
合計ジャッジ時間 7,639 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 TLE * 1 -- * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

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

for i in range(n-1):
    current = a[i]
    a[i+1:] = sorted(a[i+1:], key=lambda x: (current * x // gcd(current, x), x))

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