結果
| 問題 |
No.14 最小公倍数ソート
|
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 16:46:24 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 316 bytes |
| コンパイル時間 | 593 ms |
| コンパイル使用メモリ | 82,328 KB |
| 実行使用メモリ | 245,884 KB |
| 最終ジャッジ日時 | 2025-04-16 16:48:40 |
| 合計ジャッジ時間 | 7,579 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 TLE * 1 -- * 15 |
ソースコード
import math
n = int(input())
a = list(map(int, input().split()))
for i in range(n - 1):
current = a[i]
sub = a[i + 1:]
# Sort the subarray based on LCM with current and then the value
sub.sort(key=lambda x: (current * x // math.gcd(current, x), x))
a[i + 1:] = sub
print(' '.join(map(str, a)))
lam6er