結果
問題 |
No.14 最小公倍数ソート
|
ユーザー |
![]() |
提出日時 | 2025-06-12 20:56:42 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 320 bytes |
コンパイル時間 | 267 ms |
コンパイル使用メモリ | 82,380 KB |
実行使用メモリ | 245,300 KB |
最終ジャッジ日時 | 2025-06-12 21:00:21 |
合計ジャッジ時間 | 7,306 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 TLE * 1 -- * 15 |
ソースコード
import math n = int(input()) arr = list(map(int, input().split())) for i in range(n-1): a_i = arr[i] sub = arr[i+1:] def key_func(x): g = math.gcd(a_i, x) l = (a_i * x) // g return (l, x) sub.sort(key=key_func) arr = arr[:i+1] + sub print(' '.join(map(str, arr)))