結果
問題 | No.767 配られたジャパリまん |
ユーザー | tails |
提出日時 | 2018-12-15 15:02:13 |
言語 | cLay (20240104-1) |
結果 |
CE
|
実行時間 | - |
コード長 | 1,370 bytes |
コンパイル時間 | 4,178 ms |
コンパイル使用メモリ | 166,648 KB |
最終ジャッジ日時 | 2023-09-19 00:15:08 |
合計ジャッジ時間 | 5,171 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:1022: warning: "MD" redefined #define MD 100000007* main.cpp:6: note: this is the location of the previous definition #define MD (100000007U) main.cpp:1020:1: error: expected unqualified-id before ‘--’ token --- ^~ main.cpp:1025:1: error: ‘w’ does not name a type w; ^ main.cpp:1026:1: error: ‘k’ does not name a type k; ^ main.cpp:1027:9: error: redefinition of ‘int a [20]’ int a[20]; ^ main.cpp:950:5: note: ‘int a [20]’ previously declared here int a[20]; ^ main.cpp:1028:9: error: redefinition of ‘int b [20]’ int b[20]; ^ main.cpp:951:5: note: ‘int b [20]’ previously declared here int b[20]; ^ main.cpp:1029:13: error: redefinition of ‘mint c [1048576]’ mint c[1<<20]; ^ main.cpp:952:6: note: ‘mint c [1048576]’ previously declared here mint c[1<<20]; ^ main.cpp:1030:1: error: expected unqualified-id before ‘{’ token { ^
ソースコード
#define MD 100000007 int h,w,k; int a[20],b[20]; mint c[1<<20]; int sorted_a[20],sorted_b[20],sorted_i[20]; { combination_mint cm; cm.init(2d5); rd(h,w,k,(a,b)(k)); copy(a,a+k,sorted_a); copy(b,b+k,sorted_b); sorted_i[0..k]=(0..); sortA(k,sorted_a,sorted_b,sorted_i); rep(i,1<<k){ mint r; int pa=0,pb=0; r=__builtin_parity(i)?MD-1:1; rep(j,k){ if(i&1<<sorted_i[j]){ int qa,qb,y,x; qa=sorted_a[j]; qb=sorted_b[j]; y=qa-pa, x=qb-pb; r*=x<0?mint(0):cm.C(y+x,y); pa=qa, pb=qb; } } { int y,x; y=h-pa; x=w-pb; r*=cm.C(y+x,y); } for(int j=i;j=j-1&i,r+=(__builtin_parity(i^j)?c[j]:-c[j]),j;){ } c[i]=r; wt(r); } } --- // TLE #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]); // } //} for(int j=i;j=j-1&i;){ r+=(__builtin_parity(i^j)?c[j]:-c[j]); } c[i]=r; wt(r); } }