結果
| 問題 |
No.1846 Good Binary Matrix
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-18 23:19:11 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 514 bytes |
| コンパイル時間 | 389 ms |
| コンパイル使用メモリ | 81,844 KB |
| 実行使用メモリ | 78,896 KB |
| 最終ジャッジ日時 | 2024-06-29 09:52:20 |
| 合計ジャッジ時間 | 11,317 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 35 |
ソースコード
H,W = map(int,input().split())
P = 10 ** 9 + 7
C = W + 5
fact = [1] * C
fact_inv = [1] * C
for i in range(2,C):
fact[i] = fact[i-1] * i % P
fact_inv[-1] = pow(fact[-1],P-2,P)
for i in range(C-2,0,-1):
fact_inv[i] = fact_inv[i+1] * (i + 1) % P
def comb(n,k):
return fact[n] * fact_inv[k] % P * fact_inv[n-k] % P
ans = 0
for j in range(W+1):
if j % 2 == 0:
c = 1
else:
c = -1
tmp = comb(W,j)
t = pow(2,W-j,P)-1
s = pow(t,H,P)
ans = (ans + c * tmp) % P
print(ans)