結果

問題 No.2798 Multiple Chain
ユーザー 👑 p-adic
提出日時 2024-07-07 22:12:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 580 ms / 2,000 ms
コード長 626 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 82,700 KB
実行使用メモリ 76,216 KB
最終ジャッジ日時 2024-07-07 22:12:19
合計ジャッジ時間 6,702 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #

R=range
n=int(input())
P,t=set(),n
for i in R(2,min(n+1,9**4)):
	if t%i<1:P.add(i)
	while t%i<1:t//=i
D=[t]*(t>1)
def G(a,b):
	while a:a,b=b%a,a
	return b
while D:
	t=D.pop()
	c=int(t**0.25)*9
	if t<9**8:P.add(t)
	else:
		while c:
			x,d=c,1
			y=(x*x+1)%t
			while(d<2)*c:x,y,d,c=(x*x+1)%t,(y**4+2*y*y+2)%t,G(abs(x-y),t),c-1
			if d<t and c:t//=d;c=G(t,d);D+=[t//c,d//c,c];break
		else:P.add(t)
P.discard(1)
P=list(P)
for i in R(len(P)):
	p,c=P[i],0
	while n%p<1:n//=p;c+=1
	P[i]=[p,c]
D=[[1]*65for n in R(65)]
for i in R(63,0,-1):
	for n in R(i+1,65):D[n][i]=D[n][i+1]+D[n-i][i]*(n>=i*2)
a=1
for[p,c]in P:a*=D[c][1]
print(a)
0