結果
問題 |
No.767 配られたジャパリまん
|
ユーザー |
![]() |
提出日時 | 2018-12-15 02:05:11 |
言語 | cLay (20241019-1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 592 bytes |
コンパイル時間 | 3,302 ms |
コンパイル使用メモリ | 185,916 KB |
実行使用メモリ | 15,104 KB |
最終ジャッジ日時 | 2024-07-05 13:14:41 |
合計ジャッジ時間 | 9,011 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 14 TLE * 1 |
ソースコード
#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); } }