結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー tamatotamato
提出日時 2021-11-05 22:14:39
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 723 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 123,112 KB
最終ジャッジ日時 2024-04-24 06:02:18
合計ジャッジ時間 18,278 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
110,976 KB
testcase_01 AC 54 ms
66,816 KB
testcase_02 AC 51 ms
66,560 KB
testcase_03 AC 55 ms
68,736 KB
testcase_04 AC 56 ms
68,608 KB
testcase_05 AC 55 ms
68,608 KB
testcase_06 AC 56 ms
68,224 KB
testcase_07 AC 56 ms
69,120 KB
testcase_08 AC 51 ms
67,072 KB
testcase_09 AC 52 ms
67,328 KB
testcase_10 AC 58 ms
69,504 KB
testcase_11 AC 50 ms
67,072 KB
testcase_12 AC 50 ms
66,816 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 AC 1,461 ms
121,976 KB
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

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 a in C:
        x = C[a]
        for d in range(1, a+1):
            if d * d > a:
                break
            if a % d == 0:
                cnt[d] -= x
                if d * d != a:
                    cnt[a // d] -= x

    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