結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー rlangevinrlangevin
提出日時 2023-02-06 01:43:26
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 642 bytes
コンパイル時間 634 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 245,556 KB
最終ジャッジ日時 2023-09-17 15:04:04
合計ジャッジ時間 26,723 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 446 ms
171,788 KB
testcase_01 AC 370 ms
167,760 KB
testcase_02 AC 379 ms
167,764 KB
testcase_03 AC 474 ms
168,216 KB
testcase_04 AC 475 ms
167,944 KB
testcase_05 AC 469 ms
167,780 KB
testcase_06 AC 482 ms
167,852 KB
testcase_07 AC 480 ms
168,036 KB
testcase_08 AC 423 ms
167,480 KB
testcase_09 AC 397 ms
167,836 KB
testcase_10 AC 458 ms
168,244 KB
testcase_11 AC 363 ms
167,624 KB
testcase_12 AC 366 ms
167,648 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 AC 1,547 ms
230,708 KB
testcase_19 AC 1,613 ms
245,556 KB
testcase_20 AC 528 ms
170,912 KB
testcase_21 AC 529 ms
171,044 KB
testcase_22 AC 453 ms
171,668 KB
testcase_23 AC 425 ms
170,064 KB
testcase_24 AC 444 ms
169,484 KB
testcase_25 AC 1,696 ms
235,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *

def enum_div(M):
    L = [[1] for i in range(M + 1)]
    for i in range(2, M + 1):
        for j in range(i, M + 1, i):
            if j not in A:
                continue
            L[j].append(i)
    return L

N = int(input())
A = list(map(int, input().split()))
D = defaultdict(int)
for a in A:
    D[a] += 1
A = set(A)

M = 1010101
DD = enum_div(M)
L = [0] * M

for k, v in D.items():
    for j in DD[k]:
        L[j] += v
            
for i in range(M-2, -1, -1):
    L[i] = max(L[i], L[i + 1])
    
now = 1
for i in range(N):
    while L[now] + i >= N and L[now + 1] + i >= N:
        now += 1
    print(now)
0