結果

問題 No.767 配られたジャパリまん
ユーザー tailstails
提出日時 2018-12-15 02:05:11
言語 cLay
(20240104-1)
結果
TLE  
実行時間 -
コード長 592 bytes
コンパイル時間 2,937 ms
コンパイル使用メモリ 183,792 KB
実行使用メモリ 11,808 KB
最終ジャッジ日時 2023-09-19 00:14:49
合計ジャッジ時間 10,883 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
11,732 KB
testcase_01 AC 7 ms
11,532 KB
testcase_02 AC 7 ms
11,580 KB
testcase_03 AC 7 ms
11,588 KB
testcase_04 AC 8 ms
11,740 KB
testcase_05 AC 1,982 ms
11,536 KB
testcase_06 AC 8 ms
11,552 KB
testcase_07 AC 7 ms
11,548 KB
testcase_08 AC 8 ms
11,584 KB
testcase_09 AC 8 ms
11,808 KB
testcase_10 AC 519 ms
11,528 KB
testcase_11 AC 11 ms
11,544 KB
testcase_12 AC 10 ms
11,524 KB
testcase_13 AC 517 ms
11,540 KB
testcase_14 AC 9 ms
11,584 KB
testcase_15 AC 8 ms
11,516 KB
testcase_16 AC 11 ms
11,560 KB
testcase_17 AC 8 ms
11,524 KB
testcase_18 AC 8 ms
11,540 KB
testcase_19 AC 18 ms
11,532 KB
testcase_20 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define MD 100000007

int h,w,k;
int a[20],b[20];
mint c[1<<20];

{
	combination_mint cm;
	cm.init(2d5);
	
	rd(h,w,k,(a,b)(k));
	rep(i,1<<k){
		mint r;
		vector<pair<int,int>> v;
		rep(j,k){
			if(i&1<<j){
				v.push_back(make_pair(a[j],b[j]));
			}
		}
		sort(v.begin(),v.end());
		v.push_back(make_pair(h,w));
		r=__builtin_parity(i)?MD-1:1;
		auto p=make_pair(0,0);
		for(auto q:v){
			int y,x;
			y=q.first-p.first;
			x=q.second-p.second;
			r*=x<0?mint(0):cm.C(y+x,y);
			p=q;
		}
		rep(j,i){
			if((j&i)==j){
				r+=(__builtin_parity(i^j)?c[j]:-c[j]);
			}
		}
		c[i]=r;
		wt(r);
	}
}
0