結果

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

ソースコード

diff #
raw source code

n = int(input())
a = list(map(int,input().split()))
from collections import defaultdict
d = defaultdict(int)
import math
# ans = a[0]
for i in range(n):
    l = []
#     if i >= 1:
#         ans = math.gcd(ans,a[i])
    for j in range(1,int(a[i] ** (1/2)) + 1):
        if a[i] % j == 0:
            l.append(j)
            l.append(a[i]//j)
    for j in l:
        d[j] += 1
d2 = defaultdict(int)
for k in d.keys():
    d2[d[k]] = max(d2[d[k]],k)
ans = 1
for i in range(n):
    if (n-i) in d2:
        ans = d2[n-i]
    print(ans)
0