結果
| 問題 | No.826 連絡網 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-20 22:54:25 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 356 bytes |
| 記録 | |
| コンパイル時間 | 259 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 96,640 KB |
| 最終ジャッジ日時 | 2026-05-20 22:55:07 |
| 合計ジャッジ時間 | 19,931 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 28 TLE * 2 |
ソースコード
def aa(m):
c=[]
while m!=uf[m]:
c.append(m)
m=uf[m]
for i in c:
uf[i]=m
return m
n,p=map(int,input().split())
uf=[i for i in range(n+1)]
x=[1]*len(uf)
for i in range(2,n+1):
for j in range(i,n+1,i):
l,k=aa(i),aa(j)
if l==k:
continue
uf[k]=l
x[l]+=x[k]
print(x[aa(p)])