結果

問題 No.1730 GCD on Blackboard in yukicoder
コンテスト
ユーザー SidewaysOwl
提出日時 2021-11-05 22:21:20
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 560 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 181 ms
コンパイル使用メモリ 85,120 KB
実行使用メモリ 160,896 KB
最終ジャッジ日時 2026-05-06 17:31:22
合計ジャッジ時間 18,676 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())
a = list(map(int,input().split()))
from collections import defaultdict
d = defaultdict(int)
for i in range(n):
    j = 1
    while j ** 2 <= a[i]:
        if a[i] % j == 0:
            if not j ** 2 == a[i]:
                d[j] += 1
                d[a[i]//j] += 1
            else:
                d[j] += 1
        j += 1
d2 = defaultdict(int)
for k in d.keys():
    d2[d[k]] = max(d2[d[k]],k)
ans = max(a)
ans_l = []
for i in range(1,n+1):
    if i in d2:
        ans = d2[i]
    ans_l.append(ans)
ans_l.sort()
for i in ans_l:
    print(i)
0