結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー ああいいああいい
提出日時 2022-03-16 17:54:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 173 ms / 2,000 ms
コード長 476 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 82,532 KB
実行使用メモリ 122,804 KB
最終ジャッジ日時 2024-04-25 17:58:35
合計ジャッジ時間 5,474 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 173 ms
122,092 KB
testcase_01 AC 98 ms
86,068 KB
testcase_02 AC 103 ms
85,976 KB
testcase_03 AC 101 ms
85,656 KB
testcase_04 AC 99 ms
85,656 KB
testcase_05 AC 97 ms
86,452 KB
testcase_06 AC 103 ms
86,756 KB
testcase_07 AC 99 ms
85,512 KB
testcase_08 AC 102 ms
85,396 KB
testcase_09 AC 100 ms
85,716 KB
testcase_10 AC 103 ms
85,912 KB
testcase_11 AC 100 ms
85,520 KB
testcase_12 AC 102 ms
86,144 KB
testcase_13 AC 167 ms
122,120 KB
testcase_14 AC 165 ms
122,104 KB
testcase_15 AC 166 ms
122,268 KB
testcase_16 AC 168 ms
122,208 KB
testcase_17 AC 168 ms
122,100 KB
testcase_18 AC 168 ms
121,940 KB
testcase_19 AC 168 ms
122,804 KB
testcase_20 AC 164 ms
120,712 KB
testcase_21 AC 162 ms
120,716 KB
testcase_22 AC 162 ms
122,408 KB
testcase_23 AC 160 ms
119,444 KB
testcase_24 AC 157 ms
119,728 KB
testcase_25 AC 164 ms
121,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
C = 10 ** 6 + 1
dat = [0] * C
for a in A:
    dat[a] += 1
era = [0] * C
for i in range(2,C):
    if era[i] == 0:
        for j in range(2 * i,C,i):
            era[j] = 1
        for j in range((C-1) // i,0,-1):
            dat[j] += dat[i * j]
Max = [0] * (N + 1)
for i in range(1,C):
    Max[dat[i]] = i
for i in range(N,0,-1):
    Max[i-1] = max(Max[i-1],Max[i])
for k in range(N):
    print(Max[N - k])
#print(dat[:30])
0