結果

問題 No.736 約比
ユーザー simamumu
提出日時 2018-09-28 22:47:42
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 1,010 bytes
コンパイル時間 440 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 21,888 KB
最終ジャッジ日時 2024-10-12 07:06:29
合計ジャッジ時間 6,616 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 -- * 64
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N = int(input())
aa = inpl()

#素因数分解
def factors_nojit(n):
    gaps = [1,2,2,4,2,4,2,4,6,2,6]
    length, cycle = 11, 3
    f, fs, nxt = 2, [], 0
    while f * f <= n:
        while n % f == 0:
            fs.append(f)
            n0 = n
            n //= f
        f += gaps[nxt]
        nxt += 1
        if nxt == length:
            nxt = cycle
    if n > 1: fs.append(n)
    return fs

cnts = [defaultdict(int) for i in range(N)]
ed = set()
for i,a in enumerate(aa):
    fs = factors_nojit(a)
    for p in fs:
        ed.add(p)
        cnts[i][p] += 1

y = 1
for p in ed:
    np = INF
    for i in range(N):
        np = min(cnts[i][p],np)
    y *= pow(p,np)

ans = list(map(str,map(lambda x:x//y,aa)))
print(':'.join(ans))
0