結果

問題 No.1846 Good Binary Matrix
ユーザー 沙耶花沙耶花
提出日時 2022-02-18 22:01:56
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 235 ms / 2,000 ms
コード長 1,040 bytes
コンパイル時間 4,317 ms
コンパイル使用メモリ 265,016 KB
実行使用メモリ 19,764 KB
最終ジャッジ日時 2023-09-11 19:08:43
合計ジャッジ時間 9,036 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
19,472 KB
testcase_01 AC 40 ms
19,764 KB
testcase_02 AC 41 ms
19,460 KB
testcase_03 AC 41 ms
19,464 KB
testcase_04 AC 41 ms
19,472 KB
testcase_05 AC 41 ms
19,468 KB
testcase_06 AC 41 ms
19,452 KB
testcase_07 AC 41 ms
19,468 KB
testcase_08 AC 41 ms
19,464 KB
testcase_09 AC 40 ms
19,480 KB
testcase_10 AC 41 ms
19,480 KB
testcase_11 AC 41 ms
19,524 KB
testcase_12 AC 41 ms
19,508 KB
testcase_13 AC 41 ms
19,520 KB
testcase_14 AC 40 ms
19,524 KB
testcase_15 AC 41 ms
19,460 KB
testcase_16 AC 235 ms
19,472 KB
testcase_17 AC 226 ms
19,652 KB
testcase_18 AC 224 ms
19,468 KB
testcase_19 AC 230 ms
19,468 KB
testcase_20 AC 235 ms
19,476 KB
testcase_21 AC 41 ms
19,724 KB
testcase_22 AC 41 ms
19,504 KB
testcase_23 AC 94 ms
19,484 KB
testcase_24 AC 70 ms
19,520 KB
testcase_25 AC 204 ms
19,524 KB
testcase_26 AC 142 ms
19,460 KB
testcase_27 AC 201 ms
19,464 KB
testcase_28 AC 113 ms
19,588 KB
testcase_29 AC 148 ms
19,476 KB
testcase_30 AC 87 ms
19,472 KB
testcase_31 AC 62 ms
19,476 KB
testcase_32 AC 181 ms
19,476 KB
testcase_33 AC 64 ms
19,740 KB
testcase_34 AC 41 ms
19,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define Inf 1000000001

struct combi{
	deque<mint> kaijou;
	deque<mint> kaijou_;
	
	combi(int n){
		kaijou.push_back(1);
		for(int i=1;i<=n;i++){
			kaijou.push_back(kaijou[i-1]*i);
		}
		
		mint b=kaijou[n].inv();
		
		kaijou_.push_front(b);
		for(int i=1;i<=n;i++){
			int k=n+1-i;
			kaijou_.push_front(kaijou_[0]*k);
		}
	}
	
	mint combination(int n,int r){
		if(r>n)return 0;
		mint a = kaijou[n]*kaijou_[r];
		a *= kaijou_[n-r];
		return a;
	}
	
	mint junretsu(int a,int b){
		mint x = kaijou_[a]*kaijou_[b];
		x *= kaijou[a+b];
		return x;
	}
	
	mint catalan(int n){
		return combination(2*n,n)/(n+1);
	}
	
};

int main(){
	
	int H,W;
	cin>>H>>W;
	
	combi C(2000000);
	mint ans = 0;
	
	rep(i,W+1){
		mint t = C.combination(W,i);
		t *= mint(mint(2).pow(W-i)-1).pow(H);
		if(i%2==1)t*=-1;
		ans += t;
	}
	
	cout<<ans.val()<<endl;
	
	
	
	
	return 0;
}
0