結果

問題 No.826 連絡網
ユーザー ああいいああいい
提出日時 2022-05-29 18:15:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 409 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 81,820 KB
実行使用メモリ 387,596 KB
最終ジャッジ日時 2023-10-21 00:04:00
合計ジャッジ時間 5,553 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 41 ms
53,556 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 TLE -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 TLE -
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())

import sys
if P == 1:
    print(1)
    exit()
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
    
print(ans)
0