結果
| 問題 | No.767 配られたジャパリまん |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2018-12-15 15:02:13 |
| 言語 | cLay (20241019-1 + boost 1.89.0) |
| 結果 |
CE
|
| 実行時間 | - |
| コード長 | 1,370 bytes |
| 記録 | |
| コンパイル時間 | 4,788 ms |
| コンパイル使用メモリ | 170,284 KB |
| 最終ジャッジ日時 | 2024-07-05 13:14:58 |
| 合計ジャッジ時間 | 5,762 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:1021: warning: "MD" redefined
1021 | #define MD 100000007*
|
main.cpp:6: note: this is the location of the previous definition
6 | #define MD (100000007U)
|
main.cpp: In function ‘int main()’:
main.cpp:989:9: error: ‘j’ was not declared in this scope
989 | for(j=(0);j<(k);j++){
| ^
main.cpp: At global scope:
main.cpp:1019:1: error: expected unqualified-id before ‘--’ token
1019 | ---
| ^~
main.cpp:1024:1: error: ‘w’ does not name a type
1024 | w;
| ^
main.cpp:1025:1: error: ‘k’ does not name a type
1025 | k;
| ^
main.cpp:1026:5: error: redefinition of ‘int a [20]’
1026 | int a[20];
| ^
main.cpp:950:5: note: ‘int a [20]’ previously declared here
950 | int a[20];
| ^
main.cpp:1027:5: error: redefinition of ‘int b [20]’
1027 | int b[20];
| ^
main.cpp:951:5: note: ‘int b [20]’ previously declared here
951 | int b[20];
| ^
main.cpp:1028:6: error: redefinition of ‘mint c [1048576]’
1028 | mint c[1<<20];
| ^
main.cpp:952:6: note: ‘mint c [1048576]’ previously declared here
952 | mint c[1<<20];
| ^
main.cpp:1029:1: error: expected unqualified-id before ‘{’ token
1029 | {
| ^
ソースコード
#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);
}
}
tails