結果

問題 No.767 配られたジャパリまん
ユーザー tailstails
提出日時 2019-01-23 18:55:54
言語 cLay
(20231016-1)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 585 bytes
コンパイル時間 6,648 ms
コンパイル使用メモリ 222,520 KB
実行使用メモリ 23,864 KB
最終ジャッジ日時 2023-09-19 00:19:29
合計ジャッジ時間 8,699 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
17,632 KB
testcase_01 AC 12 ms
17,692 KB
testcase_02 AC 12 ms
17,620 KB
testcase_03 AC 12 ms
17,668 KB
testcase_04 AC 12 ms
17,672 KB
testcase_05 AC 19 ms
19,996 KB
testcase_06 AC 11 ms
17,708 KB
testcase_07 AC 12 ms
17,668 KB
testcase_08 AC 11 ms
17,896 KB
testcase_09 AC 11 ms
17,624 KB
testcase_10 AC 15 ms
17,792 KB
testcase_11 AC 12 ms
17,704 KB
testcase_12 AC 12 ms
17,628 KB
testcase_13 AC 15 ms
17,808 KB
testcase_14 AC 12 ms
17,680 KB
testcase_15 AC 12 ms
17,656 KB
testcase_16 AC 12 ms
17,816 KB
testcase_17 AC 12 ms
17,748 KB
testcase_18 AC 11 ms
17,628 KB
testcase_19 AC 12 ms
17,760 KB
testcase_20 AC 103 ms
23,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define MD 100000007

int h,w,k,a[20],b[20],c[20],f[1<<20],g[1<<20];
mint d[1<<20],e[1<<20],l;

{
	combination_mint cm;
	cm.init(3d5);
	
	rd(h,w,k,(a,b)(k));
	rep(i,k)c[i]=i;
	sortA(k,a,b,c);

	e[0]=1;
	d[0]=l=cm.C(h+w,h);
	rep(i,1,1<<k){
		int j0=ffs(i)-1;
		int j1=ffs(i&i-1)-1;
		int y=(j1<0?h:a[j1])-a[j0];
		int x=(j1<0?w:b[j1])-b[j0];
		e[i]=e[i&i-1]*cm.C(y+x,y);
		d[i]=e[i]*cm.C(a[j0]+b[j0],a[j0]);
	}
	d[0]=0;
	MoebiusTransform(1<<k,d);
	rep(i,1,1<<k)f[i]=f[i&i-1]|1<<c[ffs(i)-1];
	rep(i,1<<k)g[i]=l+(__builtin_parity(i)?-d[i]:d[i]);
	sortA(1<<k,f,g);
	rep(i,1<<k)wt(g[i]);
}
0