結果
問題 |
No.3213 depth max K
|
ユーザー |
![]() |
提出日時 | 2025-08-04 21:28:37 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 63 ms / 2,000 ms |
コード長 | 579 bytes |
コンパイル時間 | 267 ms |
コンパイル使用メモリ | 82,444 KB |
実行使用メモリ | 76,348 KB |
最終ジャッジ日時 | 2025-08-04 21:28:42 |
合計ジャッジ時間 | 4,547 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
N,K=map(int,input().split()) mod=998244353 u=[1]*(2*N+1) u2=[1]*(2*N+1) for i in range(1,2*N+1): u[i]=u[i-1]*i u[i]%=mod u2[i]=pow(u[i],-1,mod) def ncm(x,y): if y<0 or y>x: return 0 ans=u[x]*u2[y] ans%=mod ans*=u2[x-y] ans%=mod return ans result=0 for x in range(2*N+1): z=2*N-x pos=(x-z)%(2*K+4) if pos==2*K+2: result-=ncm(2*N,x) if pos==0: result+=ncm(2*N,x) result2=0 for x in range(2*N+1): z=2*N-x pos=(x-z)%(2*K+2) if pos==2*K: result2-=ncm(2*N,x) if pos==0: result2+=ncm(2*N,x) result-=result2 result%=mod print(result)