結果

問題 No.2130 分配方法の数え上げ mod 998244353
ユーザー googol_S0googol_S0
提出日時 2022-11-25 21:21:28
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 433 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 82,416 KB
実行使用メモリ 76,452 KB
最終ジャッジ日時 2024-04-10 02:29:08
合計ジャッジ時間 3,539 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
67,308 KB
testcase_01 AC 51 ms
67,320 KB
testcase_02 AC 50 ms
66,712 KB
testcase_03 AC 52 ms
66,944 KB
testcase_04 AC 51 ms
67,456 KB
testcase_05 AC 50 ms
67,612 KB
testcase_06 AC 50 ms
66,600 KB
testcase_07 AC 52 ms
66,336 KB
testcase_08 AC 50 ms
66,772 KB
testcase_09 AC 50 ms
67,820 KB
testcase_10 AC 52 ms
67,896 KB
testcase_11 AC 52 ms
67,032 KB
testcase_12 AC 53 ms
66,756 KB
testcase_13 AC 51 ms
67,252 KB
testcase_14 AC 51 ms
68,124 KB
testcase_15 AC 53 ms
66,756 KB
testcase_16 AC 52 ms
67,708 KB
testcase_17 AC 54 ms
69,008 KB
testcase_18 AC 54 ms
68,408 KB
testcase_19 AC 53 ms
67,864 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 52 ms
67,796 KB
testcase_31 AC 51 ms
66,972 KB
testcase_32 AC 50 ms
66,508 KB
testcase_33 AC 50 ms
67,608 KB
testcase_34 AC 52 ms
67,060 KB
testcase_35 AC 50 ms
67,188 KB
testcase_36 AC 52 ms
67,364 KB
testcase_37 AC 52 ms
66,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=998244353
def cmb(n,r):
  if r<0 or r>n:
    return 0
  return ((g1[n]*g2[r]%mod)*g2[n-r])%mod
 
N=300000
g1=[1]*(N+3)
for i in range(2,N+3):
  g1[i]=g1[i-1]*i%mod
g2=[0]*len(g1)
g2[-1]=pow(g1[-1],mod-2,mod)
for i in range(N+1,-1,-1):
  g2[i]=g2[i+1]*(i+1)%mod
inv=[0]*(N+3)
for i in range(1,N+3):
  inv[i]=g2[i]*g1[i-1]%mod

N=int(input())
M=int(input())
ANS=pow(2,N,mod)
N%=mod
for i in range(M):
  ANS-=cmb(N,i)
print(ANS%mod)
0