QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#409343 | #5040. Dirichlet $k$-th root | kangkunma | WA | 121ms | 24584kb | Python3 | 761b | 2024-05-11 22:10:18 | 2024-05-11 22:10:20 |
Judging History
answer
def b(x):
t=[]
while x:t+=[x%2];x//=2
return t
D=[[]for i in range(100001)]
for i in range(1,317):
for j in range(i*i,100001,i):D[j]+=[i]
k,n=map(int,input().split());l=[*map(int,input().split())];M=998244353;B=b(n);L=len(B)
X=[[0,1]+[0]*(k-1) for i in range(len(B))]
Y=[[0,1]+[0]*(k-1) for i in range(sum(B)+1)]
for i in range(2,k+1): #구할 func.값
c=0
for j in range(L-1):
for p in D[i]:X[j+1][i]=(X[j+1][i]+2*X[j][p]*X[j][i//p]-pow(X[j][p],2,M)*(p**2==i))
for j in range(L):
if B[j]:
for p in D[i]:Y[c+1][i]=(Y[c+1][i]+Y[c][p]*X[j][i//p]+Y[c][i//p]*X[j][p]-Y[c][p]*X[j][p]*(p**2==i))
c+=1
a=((l[i-1]-Y[-1][i])*pow(n,-1,M))%M
X[0][i]=a
print(*X[0][1::])
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 110ms
memory: 24584kb
input:
5 2 1 8 4 26 6
output:
1 4 2 5 3
result:
ok 5 number(s): "1 4 2 5 3"
Test #2:
score: -100
Wrong Answer
time: 121ms
memory: 24340kb
input:
1000 10 1 516238479 765833625 408427111 593035929 984641872 149832309 743527500 533342020 315774476 81082172 461044503 235289865 539969249 564590101 736090497 933661679 394417077 377363949 717587561 143428748 321957671 413061277 166846744 532438287 802900949 101236134 182814904 328306207 83339054 87...
output:
1 750394895 575705539 456042823 758074640 383892940 713754278 305477816 971222935 310729295 607054829 887137887 522651163 223374782 462972846 52388989 792137215 3038922 736507442 109554804 371629655 752900177 141130563 462594761 910063813 649851700 768630919 814343976 132655056 488741118 586990958 5...
result:
wrong answer 4th numbers differ - expected: '383612918', found: '456042823'