結果

問題 No.1846 Good Binary Matrix
ユーザー hir355hir355
提出日時 2022-02-18 23:13:00
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 419 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 86,556 KB
実行使用メモリ 87,184 KB
最終ジャッジ日時 2023-09-11 20:04:16
合計ジャッジ時間 28,432 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
83,320 KB
testcase_01 AC 83 ms
83,756 KB
testcase_02 AC 84 ms
83,528 KB
testcase_03 AC 86 ms
83,420 KB
testcase_04 AC 82 ms
83,580 KB
testcase_05 AC 85 ms
83,720 KB
testcase_06 AC 83 ms
83,484 KB
testcase_07 AC 83 ms
83,692 KB
testcase_08 AC 84 ms
83,352 KB
testcase_09 AC 82 ms
83,744 KB
testcase_10 AC 85 ms
83,428 KB
testcase_11 AC 86 ms
83,728 KB
testcase_12 AC 86 ms
83,292 KB
testcase_13 AC 86 ms
83,396 KB
testcase_14 AC 85 ms
83,716 KB
testcase_15 AC 86 ms
83,292 KB
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 AC 86 ms
83,532 KB
testcase_22 AC 85 ms
83,552 KB
testcase_23 AC 1,097 ms
84,388 KB
testcase_24 AC 639 ms
84,476 KB
testcase_25 TLE -
testcase_26 AC 1,357 ms
84,512 KB
testcase_27 TLE -
testcase_28 AC 1,037 ms
84,668 KB
testcase_29 AC 1,410 ms
84,672 KB
testcase_30 AC 662 ms
84,404 KB
testcase_31 AC 368 ms
87,020 KB
testcase_32 AC 1,806 ms
84,564 KB
testcase_33 AC 393 ms
87,184 KB
testcase_34 AC 109 ms
84,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7
fac = [1] * (10 ** 6 + 1)
for i in range(len(fac) - 1):
    fac[i + 1] = fac[i] * (i + 1) % MOD
 
def comb(n, k):
    return fac[n] * pow(fac[n - k], MOD - 2, MOD) * pow(fac[k], MOD - 2, MOD) % MOD

h, w = map(int, input().split())
ans = 0
for i in range(w):
    t = pow(pow(2, w - i, MOD) - 1, h, MOD) * comb(w, i) % MOD
    if i % 2 == 0:
        ans += t
    else:
        ans -= t
print(ans % MOD)
0