結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー roarisroaris
提出日時 2021-11-05 22:35:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 859 ms / 2,000 ms
コード長 393 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 82,712 KB
実行使用メモリ 120,868 KB
最終ジャッジ日時 2024-04-25 17:31:30
合計ジャッジ時間 11,482 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 336 ms
108,888 KB
testcase_01 AC 36 ms
54,244 KB
testcase_02 AC 238 ms
83,932 KB
testcase_03 AC 320 ms
84,252 KB
testcase_04 AC 322 ms
84,188 KB
testcase_05 AC 309 ms
83,924 KB
testcase_06 AC 327 ms
84,188 KB
testcase_07 AC 323 ms
84,128 KB
testcase_08 AC 39 ms
55,936 KB
testcase_09 AC 198 ms
81,868 KB
testcase_10 AC 247 ms
81,836 KB
testcase_11 AC 39 ms
53,620 KB
testcase_12 AC 40 ms
54,352 KB
testcase_13 AC 738 ms
117,292 KB
testcase_14 AC 767 ms
117,448 KB
testcase_15 AC 799 ms
117,556 KB
testcase_16 AC 859 ms
117,440 KB
testcase_17 AC 733 ms
117,616 KB
testcase_18 AC 245 ms
114,968 KB
testcase_19 AC 516 ms
120,868 KB
testcase_20 AC 347 ms
108,740 KB
testcase_21 AC 348 ms
109,140 KB
testcase_22 AC 283 ms
107,964 KB
testcase_23 AC 126 ms
103,612 KB
testcase_24 AC 327 ms
115,864 KB
testcase_25 AC 562 ms
120,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

N = int(input())
A = list(map(int, input().split()))
acnt = Counter(A)
M = max(A)
cnt = [0]*(M+1)

for i in range(1, M+1):
    for j in range(i, M+1, i):
        cnt[i] += acnt[j]

d = defaultdict(int)

for i in range(M+1):
    d[cnt[i]] = max(d[cnt[i]], i)

ans = 1

for K in range(N):
    ans = max(ans, d[N-K])
    print(ans)
0