結果

問題 No.1655 123 Swaps
ユーザー kozykozy
提出日時 2021-08-21 01:18:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 2,671 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 13,056 KB
実行使用メモリ 198,732 KB
最終ジャッジ日時 2024-04-22 10:49:15
合計ジャッジ時間 23,975 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,127 ms
107,864 KB
testcase_01 AC 1,119 ms
101,716 KB
testcase_02 AC 1,099 ms
102,384 KB
testcase_03 AC 1,106 ms
101,716 KB
testcase_04 AC 1,116 ms
102,124 KB
testcase_05 AC 1,095 ms
102,236 KB
testcase_06 AC 1,118 ms
101,868 KB
testcase_07 AC 1,091 ms
102,488 KB
testcase_08 AC 1,113 ms
102,116 KB
testcase_09 AC 1,117 ms
102,508 KB
testcase_10 AC 1,134 ms
102,236 KB
testcase_11 AC 1,106 ms
102,240 KB
testcase_12 AC 1,093 ms
102,376 KB
testcase_13 AC 1,093 ms
102,120 KB
testcase_14 AC 1,108 ms
101,868 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
mod=924844033
inv2=pow(2,mod-2,mod)
def fft_len(N):
    fftlen=1
    beki=0
    while fftlen<N:
      fftlen*=2
      beki+=1
    return fftlen,beki
def FPStime(L,R):
  fftlen,beki=fft_len(len(L)+len(R))
  FS=np.fft.rfft(L, fftlen)
  FT=np.fft.rfft(R, fftlen)
  Fh=FS*FT
  h = np.fft.irfft(Fh, fftlen)
  h = np.rint(h).astype(np.int64)
  return h[:len(L) + len(R) - 1]
def FPStime2(L,R,mod):
  f1,f2=np.divmod(L,1<<15)
  g1,g2=np.divmod(R,1<<15)
  a=FPStime(f1,g1)%mod
  c=FPStime(f2,g2)%mod
  b=(FPStime(f1+f2,g1+g2)-(a+c))%mod
  h=(a<<30)+(b<<15)+c
  return h%mod
def FPSinv(f):
  """
  1/f=gをreturn
  """
  f=np.array(f, np.int64)
  this_len,this_roop=fft_len(len(f))
  c=pow(int(f[0]),-1,mod)
  g=np.array([c], np.int64)
  a=1
  for i in range(this_roop):
      a*=2
      S=FPStime2(g,f,mod)[:a]
      S*=-1
      S[0]+=2
      S=[i%mod for i in S]
      g=FPStime2(g,S,mod)
      g=g[:a]
      g=[i%mod for i in g]
  return g[:len(f)+1]
def FPSsqrt(f):
  """
  sqrt(f)=gをreturn
  """
  f=np.array(f, np.float64)
  g=np.array([f[0]**0.5], np.float64)
  this_len,this_roop=fft_len(len(f))
  a=1
  for i in range(this_roop):
      a*=2
      g=FPSplus(FPStime(f,FPSinv(g)),g)
      g=g*inv2
      g=g[:a]
      g=[i%mod for i in g]
  return g[:len(f)]
def keisu(P,Q,N):#P(x)/Q(x)のx^Nの係数
  Q2=list()
  for i in range(len(Q)):
    if N==0:
      return P[0]
    if i%2==0:
      Q2.append(Q[i])
    else:
      Q2.append(-Q[i])
  S=FPStime2(Q,Q2,mod)
  V=list()
  for i in range(0,len(S),2):
    V.append(S[i])
  Ue=list()
  Uo=list()
  P=FPStime2(P,Q2,mod)
  for i in range(len(P)):
    if i%2==0:
      Ue.append(P[i])
    else:
      Uo.append(P[i])
  if N%2==0:
    return keisu(Ue,V,N//2)
  else:
    return keisu(Uo,V,N//2)


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=FPStime2(L[x],R[((B+2*x-A)*2)%3],mod)
  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