結果

問題 No.1846 Good Binary Matrix
ユーザー 👑 colognecologne
提出日時 2022-03-14 21:05:03
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 425 ms / 2,000 ms
コード長 557 bytes
コンパイル時間 3,321 ms
コンパイル使用メモリ 250,220 KB
実行使用メモリ 7,212 KB
最終ジャッジ日時 2023-10-21 08:11:48
合計ジャッジ時間 9,360 ms
ジャッジサーバーID
(参考情報)
judge10 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 425 ms
7,212 KB
testcase_17 AC 417 ms
7,212 KB
testcase_18 AC 406 ms
7,212 KB
testcase_19 AC 394 ms
6,948 KB
testcase_20 AC 421 ms
7,212 KB
testcase_21 AC 166 ms
5,432 KB
testcase_22 AC 177 ms
5,432 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 299 ms
6,224 KB
testcase_26 AC 193 ms
5,168 KB
testcase_27 AC 12 ms
4,348 KB
testcase_28 AC 42 ms
4,348 KB
testcase_29 AC 127 ms
4,640 KB
testcase_30 AC 331 ms
6,488 KB
testcase_31 AC 293 ms
6,224 KB
testcase_32 AC 345 ms
6,488 KB
testcase_33 AC 396 ms
7,212 KB
testcase_34 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using Mint = atcoder::modint1000000007;

int main()
{
    int H, W;
    cin >> H >> W;
    vector<Mint> fact(H + 1);
    fact[0] = 1;
    for (int i = 1; i <= H; i++)
        fact[i] = i * fact[i - 1];
    auto C = [&](int N, int r)
    {
        return fact[N] / (fact[r] * fact[N - r]);
    };
    Mint ans = 0;
    for (int r = 0; r <= H; r++)
        ans += Mint(-1).pow(r) * C(H, r) * (-Mint(2).pow(r) + 1).pow(W);
    ans *= Mint(-1).pow(H + W);

    cout << ans.val() << endl;
}
0