結果

問題 No.826 連絡網
ユーザー ああいいああいい
提出日時 2022-05-29 18:13:49
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 474 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 350,956 KB
最終ジャッジ日時 2023-10-21 00:03:41
合計ジャッジ時間 5,408 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,512 KB
testcase_01 AC 35 ms
53,512 KB
testcase_02 AC 43 ms
62,224 KB
testcase_03 AC 58 ms
70,612 KB
testcase_04 AC 60 ms
70,620 KB
testcase_05 AC 58 ms
68,572 KB
testcase_06 AC 56 ms
68,556 KB
testcase_07 AC 64 ms
70,616 KB
testcase_08 AC 58 ms
68,572 KB
testcase_09 AC 59 ms
70,604 KB
testcase_10 AC 53 ms
66,468 KB
testcase_11 AC 62 ms
68,548 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,P = map(int,input().split())

div = [[] for _ in range(N + 1)]
for i in range(2,N):
    for j in range(2 * i,N + 1,i):
        div[j].append(i)
ans = 0
stack = [P]
memo = [0] * (N + 1)
memo[P] = 1
while stack:
    now = stack.pop()
    ans += 1
    for d in div[now]:
        if memo[d] == 0:
            stack.append(d)
            memo[d] = 1
    for j in range(2 * now,N + 1,now):
        if memo[j] == 0:
            memo[j] = 1
            stack.append(j)
print(ans)
0