結果

問題 No.2083 OR Subset
ユーザー googol_S0googol_S0
提出日時 2022-09-26 05:25:19
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 536 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 87,956 KB
最終ジャッジ日時 2023-08-24 02:43:57
合計ジャッジ時間 32,934 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
82,880 KB
testcase_01 AC 85 ms
83,140 KB
testcase_02 AC 91 ms
83,224 KB
testcase_03 AC 1,849 ms
83,460 KB
testcase_04 AC 965 ms
83,444 KB
testcase_05 TLE -
testcase_06 AC 936 ms
83,416 KB
testcase_07 AC 156 ms
83,508 KB
testcase_08 AC 188 ms
83,736 KB
testcase_09 AC 1,929 ms
83,336 KB
testcase_10 AC 1,270 ms
83,408 KB
testcase_11 AC 672 ms
83,440 KB
testcase_12 AC 469 ms
83,488 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 AC 86 ms
82,876 KB
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

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())
P=[0]*(N+1)
P[0]=1
for i in range(N):
  P[i+1]=P[i]*2%mod
ANS=0
for K in range(N+1):
  v=1
  for i in range(K+1):
    ANS=(ANS+(pow(P[K]-i,N,mod)*cmb(K,i)*v%mod)*g2[K])%mod
    v=-v
print(ANS)
0