結果
| 問題 | No.14 最小公倍数ソート |
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 15:52:41 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 232 bytes |
| 記録 | |
| コンパイル時間 | 234 ms |
| コンパイル使用メモリ | 95,848 KB |
| 実行使用メモリ | 290,560 KB |
| 最終ジャッジ日時 | 2026-07-11 15:20:47 |
| 合計ジャッジ時間 | 8,079 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 TLE * 1 -- * 15 |
ソースコード
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)))
gew1fw