結果

問題 No.2130 分配方法の数え上げ mod 998244353
ユーザー flygonflygon
提出日時 2022-11-25 21:28:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 768 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 82,848 KB
実行使用メモリ 86,296 KB
最終ジャッジ日時 2024-04-10 02:39:06
合計ジャッジ時間 2,900 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
54,904 KB
testcase_01 AC 40 ms
55,488 KB
testcase_02 AC 39 ms
55,492 KB
testcase_03 AC 37 ms
55,232 KB
testcase_04 AC 40 ms
56,188 KB
testcase_05 AC 40 ms
55,044 KB
testcase_06 WA -
testcase_07 AC 41 ms
55,636 KB
testcase_08 AC 39 ms
55,176 KB
testcase_09 AC 38 ms
54,556 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 39 ms
55,164 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 40 ms
54,924 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 40 ms
54,752 KB
testcase_29 WA -
testcase_30 AC 40 ms
55,304 KB
testcase_31 WA -
testcase_32 AC 39 ms
54,560 KB
testcase_33 WA -
testcase_34 AC 40 ms
54,564 KB
testcase_35 WA -
testcase_36 AC 40 ms
55,888 KB
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
import pypyjit
pypyjit.set_param('max_unroll_recursion=-1')
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd
mod = 998244353

n = int(input())
m = int(input())
ans = pow(2, n, mod) - 1
if m > n:
  print(0)
  exit()
#nCk
def com(n,mod):
  fact = [1,1]
  factinv = [1,1]
  inv = [0,1]
  for i in range(2,n+1):
    fact.append((fact[-1]*i)%mod)
    inv.append((-inv[mod%i]*(mod//i))%mod)
    factinv.append((factinv[-1]*inv[-1])%mod)
  return fact, factinv

f,fi = com(m+10, mod)

ue = m

for i in range(1,m):
  tmp = ue * fi[i] % mod
  ans -= tmp
  ans %= mod
  ue *= m-i
  ue %= mod

print(ans)
0