結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー 👑 tamatotamato
提出日時 2021-11-05 22:27:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 853 ms / 2,000 ms
コード長 806 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 121,088 KB
最終ジャッジ日時 2024-04-25 17:27:48
合計ジャッジ時間 11,474 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 212 ms
105,504 KB
testcase_01 AC 145 ms
83,856 KB
testcase_02 AC 149 ms
84,004 KB
testcase_03 AC 208 ms
83,824 KB
testcase_04 AC 210 ms
83,952 KB
testcase_05 AC 217 ms
83,784 KB
testcase_06 AC 209 ms
83,836 KB
testcase_07 AC 212 ms
84,028 KB
testcase_08 AC 183 ms
83,736 KB
testcase_09 AC 165 ms
84,172 KB
testcase_10 AC 216 ms
83,952 KB
testcase_11 AC 145 ms
83,848 KB
testcase_12 AC 152 ms
84,156 KB
testcase_13 AC 853 ms
117,584 KB
testcase_14 AC 758 ms
117,244 KB
testcase_15 AC 733 ms
117,528 KB
testcase_16 AC 781 ms
117,396 KB
testcase_17 AC 779 ms
117,704 KB
testcase_18 AC 696 ms
121,088 KB
testcase_19 AC 633 ms
120,776 KB
testcase_20 AC 274 ms
104,636 KB
testcase_21 AC 272 ms
104,600 KB
testcase_22 AC 209 ms
105,656 KB
testcase_23 AC 206 ms
111,712 KB
testcase_24 AC 211 ms
111,676 KB
testcase_25 AC 634 ms
120,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9
NN = 10 ** 6


def main():
    import sys
    from collections import Counter
    input = sys.stdin.readline

    N = int(input())
    A = list(map(int, input().split()))
    C = Counter(A)

    cnt = [N] * (NN + 1)
    for i in range(101, NN+1):
        for x in range(1, NN+1):
            if i * x > NN:
                break
            if i * x in C:
                k = C[i * x]
                cnt[i] -= k

    for a in C:
        k = C[a]
        for d in range(1, 101):
            if a % d == 0:
                cnt[d] -= k

    ans = [1] * (N+1)
    for x in range(1, NN+1):
        k = cnt[x]
        ans[k] = x
    for i in range(1, N+1):
        ans[i] = max(ans[i], ans[i-1])
    for i in range(N):
        print(ans[i])


if __name__ == '__main__':
    main()
0