結果

問題 No.1846 Good Binary Matrix
ユーザー googol_S0googol_S0
提出日時 2022-02-18 21:31:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,115 ms / 2,000 ms
コード長 471 bytes
コンパイル時間 426 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 194,888 KB
最終ジャッジ日時 2023-09-11 18:36:24
合計ジャッジ時間 18,866 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 214 ms
193,100 KB
testcase_01 AC 207 ms
192,924 KB
testcase_02 AC 206 ms
192,924 KB
testcase_03 AC 206 ms
192,992 KB
testcase_04 AC 205 ms
193,040 KB
testcase_05 AC 205 ms
193,148 KB
testcase_06 AC 208 ms
193,156 KB
testcase_07 AC 206 ms
193,000 KB
testcase_08 AC 205 ms
192,984 KB
testcase_09 AC 206 ms
193,000 KB
testcase_10 AC 207 ms
192,936 KB
testcase_11 AC 209 ms
192,956 KB
testcase_12 AC 205 ms
192,928 KB
testcase_13 AC 206 ms
193,104 KB
testcase_14 AC 203 ms
193,180 KB
testcase_15 AC 203 ms
193,036 KB
testcase_16 AC 1,077 ms
193,188 KB
testcase_17 AC 1,115 ms
193,300 KB
testcase_18 AC 1,053 ms
193,280 KB
testcase_19 AC 1,085 ms
193,016 KB
testcase_20 AC 1,099 ms
193,344 KB
testcase_21 AC 444 ms
193,020 KB
testcase_22 AC 466 ms
193,228 KB
testcase_23 AC 204 ms
192,936 KB
testcase_24 AC 206 ms
193,004 KB
testcase_25 AC 836 ms
193,360 KB
testcase_26 AC 628 ms
193,436 KB
testcase_27 AC 231 ms
193,676 KB
testcase_28 AC 299 ms
194,888 KB
testcase_29 AC 474 ms
193,440 KB
testcase_30 AC 934 ms
193,288 KB
testcase_31 AC 813 ms
193,280 KB
testcase_32 AC 947 ms
193,132 KB
testcase_33 AC 1,051 ms
193,344 KB
testcase_34 AC 209 ms
193,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=10**9+7
def cmb(n,r):
  if r<0 or r>n:
    return 0
  return ((g1[n]*g2[r]%mod)*g2[n-r])%mod
 
N=5000000
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


H,W=map(int,input().split())
ANS=0
x=1
for i in range(H+1):
  ANS=(ANS+(x*cmb(H,i)%mod)*pow(pow(2,H-i,mod)-1,W,mod))%mod
  x=mod-x
print(ANS)
0