結果

問題 No.1655 123 Swaps
ユーザー kozykozy
提出日時 2021-08-21 01:26:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 984 ms / 2,000 ms
コード長 2,972 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 82,160 KB
実行使用メモリ 208,512 KB
最終ジャッジ日時 2024-04-22 10:59:27
合計ジャッジ時間 24,247 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 161 ms
174,720 KB
testcase_01 AC 160 ms
174,720 KB
testcase_02 AC 205 ms
188,032 KB
testcase_03 AC 157 ms
174,720 KB
testcase_04 AC 166 ms
175,232 KB
testcase_05 AC 163 ms
174,976 KB
testcase_06 AC 162 ms
175,104 KB
testcase_07 AC 161 ms
174,848 KB
testcase_08 AC 161 ms
174,720 KB
testcase_09 AC 165 ms
176,896 KB
testcase_10 AC 183 ms
184,704 KB
testcase_11 AC 179 ms
179,200 KB
testcase_12 AC 191 ms
184,960 KB
testcase_13 AC 160 ms
174,592 KB
testcase_14 AC 157 ms
174,464 KB
testcase_15 AC 979 ms
207,568 KB
testcase_16 AC 964 ms
207,744 KB
testcase_17 AC 967 ms
208,000 KB
testcase_18 AC 969 ms
208,000 KB
testcase_19 AC 977 ms
208,000 KB
testcase_20 AC 974 ms
208,000 KB
testcase_21 AC 958 ms
208,000 KB
testcase_22 AC 965 ms
208,256 KB
testcase_23 AC 984 ms
208,440 KB
testcase_24 AC 966 ms
208,512 KB
testcase_25 AC 972 ms
208,384 KB
testcase_26 AC 954 ms
206,848 KB
testcase_27 AC 587 ms
199,440 KB
testcase_28 AC 578 ms
197,760 KB
testcase_29 AC 955 ms
204,800 KB
testcase_30 AC 959 ms
204,288 KB
testcase_31 AC 579 ms
197,376 KB
testcase_32 AC 161 ms
174,848 KB
testcase_33 AC 160 ms
174,464 KB
testcase_34 AC 157 ms
174,592 KB
testcase_35 AC 160 ms
175,488 KB
testcase_36 AC 577 ms
197,760 KB
testcase_37 AC 557 ms
197,760 KB
testcase_38 AC 574 ms
198,120 KB
testcase_39 AC 567 ms
197,760 KB
testcase_40 AC 948 ms
207,744 KB
testcase_41 AC 155 ms
174,592 KB
testcase_42 AC 155 ms
174,592 KB
testcase_43 AC 158 ms
174,720 KB
testcase_44 AC 155 ms
174,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=924844033
root=pow(5,441,mod)
rootinv=pow(root,mod-2,mod)
bbeki=[0]*22
bbeki2=[0]*22
beki_dic=dict()
this=1
for i in range(22):
  beki_dic[this]=i
  this*=2
def beki_mae():
  x=root
  beki=1
  for i in range(21,-1,-1):
    bbeki[i]=x
    x=x**2
    x%=mod
  x=rootinv
  beki=1
  for i in range(21,-1,-1):
    bbeki2[i]=x
    x=x**2
    x%=mod
beki_mae()
def rev(i,k):
  ans=0
  s=bin(i)[2:]
  for i in range(len(s)):
    if s[len(s)-1-i]=="1":
      ans+=2**(k-1-i)
  return ans
def NTT_len(a):#a<=2^Nを満たす最小のNを返す
  k=1
  b=0
  for i in range(100):
    if k>=a:
      break
    else:
      k*=2
      b+=1
  return b
def NTT_change0(A,k):#長さ2^kにする
  N=len(A)
  A=A+[0]*(2**k-N)
  NTT_change(A)
  return A
def NTT_change(A):#Aをstart<=k<finまでNTT変換,f(x^i)(i=0~N-1)を求める
  N=len(A)
  le=N
  while le>1:
    x=bbeki[beki_dic[le]]
    for st in range(N//le):
      this=1
      for i in range(le//2):
        l=A[st*le+i]
        r=A[st*le+i+le//2]
        A[st*le+i]=(l+r)%mod
        A[st*le+i+le//2]=((l-r)*this)%mod
        this*=x
        this%=mod
    le//=2

def NTT_invchange0(A,k):#長さ2^kにする
  N=len(A)
  A=A+[0]*(2**k-N)
  NTT_invchange(A)
  return A
def NTT_invchange(A):#Aをstart<=k<finまでNTT変換,f(x^i)(i=0~N-1)を求める
  N=len(A)
  le=2
  while le<=N:
    x=bbeki2[beki_dic[le]]
    for st in range(N//le):
      this=1
      for i in range(le//2):
        l=A[st*le+i]
        r=A[st*le+i+le//2]*this
        r%=mod
        A[st*le+i]=(l+r)%mod
        A[st*le+i+(le//2)]=(l-r)%mod
        this*=x
        this%=mod
    le*=2
  invN=pow(N,mod-2,mod)
  for i in range(N):
    A[i]*=invN
    A[i]%=mod
def NTT_time(A,B):#A,Bの畳み込み
  n=len(A)
  m=len(B)
  k=NTT_len(n+m-1)
  A=NTT_change0(A,k)
  B=NTT_change0(B,k)
  c=list()
  for i in range(len(A)):
    c.append(A[i]*B[i]%mod)
  c=NTT_invchange0(c,k)
  return c[:n+m-1]

def NTTinv(f):
  """
  1/f=gをreturn
  """
  le=len(f)
  this_roop=NTT_len(len(f))
  c=pow(int(f[0]),mod-2,mod)
  g=[c]
  a=1
  for i in range(this_roop):
      a*=2
      S=NTT_time(g,f)[:a]
      S=[-i%mod for i in S]
      S[0]+=2
      g=NTT_time(g,S)[:a]
  return g[:le]
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
N=5*(10**5)
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
a,b,c=map(int,input().split())
A=a
B=b
C=c
N=a+b+c
if N%2==1:
  print(0)
  exit()
L=[[0]*(A+1) for i in range(3)]
R=[[0]*(B+1) for i in range(3)]
for x in range(A+1):
  L[x%3][x]=g2[x]*g2[A-x]%mod
for y in range(B+1):
  R[y%3][y]=g2[y]*g2[B-y]%mod
C=[0]*(A+B+1)
for x in range(3):
  S=NTT_time(L[x],R[((B+2*x-A)*2)%3])
  for i in range(len(S)):
    C[i]+=S[i]
    C[i]%=mod
for i in range(A+B+1):
  C[i]*=(g1[(N//2)]**2)*g2[(N//2)-i]*g2[(N//2)-A-B+i]%mod
  C[i]%=mod
ans=0
for i in range((N//2)-c,(N//2)+1):
  if 0<=i<=A+B:
    ans+=C[i]
    ans%=mod
print(ans)
0