結果
| 問題 |
No.14 最小公倍数ソート
|
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 15:54:26 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 263 bytes |
| コンパイル時間 | 248 ms |
| コンパイル使用メモリ | 82,308 KB |
| 実行使用メモリ | 227,972 KB |
| 最終ジャッジ日時 | 2025-06-12 15:54:34 |
| 合計ジャッジ時間 | 7,295 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 TLE * 1 -- * 15 |
ソースコード
from math import gcd
n = int(input())
a = list(map(int, input().split()))
for i in range(n-1):
current = a[i]
remaining = a[i+1:]
remaining.sort(key=lambda x: (current * x // gcd(current, x), x))
a[i+1:] = remaining
print(' '.join(map(str, a)))
gew1fw