結果

問題 No.2520 L1 Explosion
ユーザー tailstails
提出日時 2023-10-30 12:22:54
言語 cLay
(20240104-1)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 502 bytes
コンパイル時間 6,429 ms
コンパイル使用メモリ 222,352 KB
実行使用メモリ 7,940 KB
最終ジャッジ日時 2023-10-30 12:23:03
合計ジャッジ時間 8,153 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,640 KB
testcase_01 AC 2 ms
7,644 KB
testcase_02 AC 2 ms
7,644 KB
testcase_03 AC 2 ms
7,640 KB
testcase_04 AC 2 ms
7,640 KB
testcase_05 AC 2 ms
7,640 KB
testcase_06 AC 37 ms
7,940 KB
testcase_07 AC 20 ms
7,848 KB
testcase_08 AC 37 ms
7,940 KB
testcase_09 AC 3 ms
7,744 KB
testcase_10 AC 47 ms
7,916 KB
testcase_11 AC 46 ms
7,916 KB
testcase_12 AC 46 ms
7,920 KB
testcase_13 AC 26 ms
7,828 KB
testcase_14 AC 27 ms
7,828 KB
testcase_15 AC 3 ms
7,668 KB
testcase_16 AC 20 ms
7,800 KB
testcase_17 AC 12 ms
7,756 KB
testcase_18 AC 14 ms
7,760 KB
testcase_19 AC 10 ms
7,752 KB
testcase_20 AC 3 ms
7,664 KB
testcase_21 AC 29 ms
7,868 KB
testcase_22 AC 5 ms
7,712 KB
testcase_23 AC 31 ms
7,692 KB
testcase_24 AC 24 ms
7,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define MD 998244353
ll@n,@m;
ll u[2n],v1[2n],v2[2n],w[2n];
rep(i,n){
	ll@x,@y,@h;
	u[i*2+0]=x+y-(m-h);
	u[i*2+1]=x+y+(m-h);
	v1[i*2+0]=v1[i*2+1]=x-y-(m-h);
	v2[i*2+0]=v2[i*2+1]=x-y+(m-h);
	w[i*2+0]=1;
	w[i*2+1]=-1;
}
sortA(2n,u,v1,v2,w);
map<ll,ll>a;
ll z[n+1]{},p=0;
rep(i,2n){
	ll r=0,s=0;
	for(auto t=a.begin();t!=a.end();t->second==0?t=a.erase(t):++t){
		z[s]+=(t->first-r)*(u[i]-p);
		r=t->first;
		s+=t->second;
	}
	p=u[i];
	a[v1[i]]+=w[i];
	a[v2[i]]-=w[i];
}
rep(i,1,n+1){
	wt(Mint(z[i])/2);
}
0