結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-11-05 21:36:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 338 ms / 2,000 ms
コード長 308 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 82,732 KB
実行使用メモリ 102,612 KB
最終ジャッジ日時 2024-04-25 17:16:00
合計ジャッジ時間 7,874 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 183 ms
102,388 KB
testcase_01 AC 241 ms
67,872 KB
testcase_02 AC 274 ms
67,780 KB
testcase_03 AC 133 ms
83,852 KB
testcase_04 AC 134 ms
83,644 KB
testcase_05 AC 243 ms
68,656 KB
testcase_06 AC 134 ms
83,856 KB
testcase_07 AC 134 ms
83,692 KB
testcase_08 AC 232 ms
68,952 KB
testcase_09 AC 135 ms
83,496 KB
testcase_10 AC 132 ms
83,716 KB
testcase_11 AC 258 ms
67,728 KB
testcase_12 AC 239 ms
69,824 KB
testcase_13 AC 338 ms
102,572 KB
testcase_14 AC 335 ms
102,508 KB
testcase_15 AC 326 ms
102,592 KB
testcase_16 AC 326 ms
102,332 KB
testcase_17 AC 315 ms
102,612 KB
testcase_18 AC 177 ms
102,020 KB
testcase_19 AC 330 ms
102,456 KB
testcase_20 AC 186 ms
101,216 KB
testcase_21 AC 178 ms
101,404 KB
testcase_22 AC 178 ms
102,304 KB
testcase_23 AC 336 ms
99,700 KB
testcase_24 AC 303 ms
100,632 KB
testcase_25 AC 314 ms
102,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
M = 10**6+5
L = [0]*M
for a in map(int,input().split()):
    L[a] += 1

ans = [1]*(n+1)
for i in range(2,M)[::-1]:

    count = 0
    for j in range(i,M,i):
        count += L[j]
    ans[n-count] = max(ans[n-count],i)

for i in range(n):
    print(ans[i])
    ans[i+1] = max(ans[i],ans[i+1])
0